To: Dr. Random

From: 201Team1, Yiling Du, Bryce Hawkins, Onyekachi Igwenagu, Alec Mattu, Delmar Randolph

Subject: Analysis of 110 automotive vehicle models from 2015

Background

Our 2015 Vehicle Model Year Dataset is derived from data provided and compiled by KBB.com in 2015. Within this detailed analysis of our dataset, we want to derive inferences on various levels of means and proportions. Our population of interest revolves around vehicle models available in the United States during the 2015 new model release cycle (2015 model year). A snapshot of our dataset features and attributes is included below, with example values:

Table Code

|  Variable | Name|Example|Type (Quant. / Cat.)|
|:---------|:------------------------------------------|:----------------------------:|:-|
|    Make   | Vehicle manufacturer                              | Toyota                       |Categorical|
|   Model   | Vehicle model                                     | Prius                        |Categorical|
|    Type   | Vehicle category                                  | Hatchback |Categorical|
|  LowPrice | Lowest MSRP Available (In 1000s)                  | 6.5                          |Quant.|
| HighPrice | Highest MSRP Available (In 1000s)                 | 9.5                          |Quant.|
| Drive     | Vehicle output driveaxle                          | FWD                          |Categorical|
| CityMPG   | City miles per gallon avg                         | 36                           |Quant.|
| HwyMPG    | Highway miles per gallon avg                      | 44                           |Quant.|
| FuelCap   | Gas tank capacity in gallons                      | 12.5                         |Quant.|
| Length    | Bumper-to-bumper vehicle length (Inch)            | 178.5                        |Quant.|
| Width     | Door-to-door vehicle width (Inch)                 | 69.2                         |Quant.|
| Height    | Vehicle height from ground-to-roof (Inch)         | 58.1                         |Quant.|
| Wheelbase | Vehicle wheelbase (Inch)                          | 106.5                        |Quant.|
| UTurn     | Vehicle 180deg U-turn radius (Feet)               | 16                           |Quant.|
| Weight    | Vehicle dry weight (Lbs)                          | 2200                         |Quant.|
| Acc030    | Vehicle accel. to 30mph (Seconds)                 | 62                           |Quant.|
| Acc060    | Vehicle accel. to 60mph (Seconds)                 | 190                          |Quant.|
| QtrMile   | Vehicle time in seconds to 1/4th mile             | 92                           |Quant.|
| Size      | Vehicle size (Small, Midsized, Large)             | Large                        |Categorical|

Table of Variables

Variable Name Example Type (Quant. / Cat.)
Make Vehicle manufacturer Toyota Categorical
Model Vehicle model Prius Categorical
Type Vehicle category Hatchback Categorical
LowPrice Lowest MSRP Available (In 1000s) 6.5 Quant.
HighPrice Highest MSRP Available (In 1000s) 9.5 Quant.
Drive Vehicle output driveaxle FWD Categorical
CityMPG City miles per gallon avg 36 Quant.
HwyMPG Highway miles per gallon avg 44 Quant.
FuelCap Gas tank capacity in gallons 12.5 Quant.
Length Bumper-to-bumper vehicle length (Inch) 178.5 Quant.
Width Door-to-door vehicle width (Inch) 69.2 Quant.
Height Vehicle height from ground-to-roof (Inch) 58.1 Quant.
Wheelbase Vehicle wheelbase (Inch) 106.5 Quant.
UTurn Vehicle 180deg U-turn radius (Feet) 16 Quant.
Weight Vehicle dry weight (Lbs) 2200 Quant.
Acc030 Vehicle accel. to 30mph (Seconds) 62 Quant.
Acc060 Vehicle accel. to 60mph (Seconds) 190 Quant.
QtrMile Vehicle time in seconds to 1/4th mile 92 Quant.
Size Vehicle size (Small, Midsized, Large) Large Categorical

Analyses

# Fixes a HTML compilation bug (ignore)
r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)

Analysis 1: Chi-square Test of Independence

Analyst: Yiling Du

Topic for Analysis 1: test for the association between “Drive” variable and “Size” variable. Drive: the type of drive (FWD, RWD,AWD); Size: the size of car (Small, Midsized, Large). Each variable has three categories.

First, call the packages that are needed for the analysis:

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
## ✓ tibble  3.1.0     ✓ dplyr   1.0.5
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
#install.packages("sjstats")
library (sjstats)
library (pwr)
install.packages("car")
## 
## The downloaded binary packages are in
##  /var/folders/0s/cwbp3rpx67q0ts2h2xvhzzbh0000gn/T//Rtmpt3GvSH/downloaded_packages
library (car)
## Loading required package: carData
## Registered S3 methods overwritten by 'car':
##   method                          from
##   influence.merMod                lme4
##   cooks.distance.influence.merMod lme4
##   dfbeta.influence.merMod         lme4
##   dfbetas.influence.merMod        lme4
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
## The following object is masked from 'package:purrr':
## 
##     some

Load Data:

cars <- read.csv("./Cars2015.csv", header=T)
cars
str(cars)
## 'data.frame':    110 obs. of  20 variables:
##  $ Make     : chr  "Chevrolet" "Hyundai" "Kia" "Mitsubishi" ...
##  $ Model    : chr  "Spark" "Accent" "Rio" "Mirage" ...
##  $ Type     : chr  "Hatchback" "Hatchback" "Sedan" "Hatchback" ...
##  $ LowPrice : num  12.3 14.7 14 13 14.2 ...
##  $ HighPrice: num  25.6 17.5 18.3 15.4 18 ...
##  $ Drive    : chr  "FWD" "FWD" "FWD" "FWD" ...
##  $ CityMPG  : int  30 28 28 37 31 23 24 24 28 30 ...
##  $ HwyMPG   : int  39 37 36 44 40 35 36 33 38 35 ...
##  $ FuelCap  : num  9 11.4 11.3 9.2 10.9 14.2 15.6 13.1 12.4 11.1 ...
##  $ Length   : int  145 172 172 149 164 184 181 167 179 154 ...
##  $ Width    : int  63 67 68 66 67 72 71 70 72 67 ...
##  $ Wheelbase: int  94 101 101 97 102 106 106 103 104 99 ...
##  $ Height   : int  61 57 57 59 61 58 58 66 58 59 ...
##  $ UTurn    : int  34 37 37 32 37 38 38 37 39 34 ...
##  $ Weight   : int  2345 2550 2575 2085 2470 3260 3140 3330 2990 2385 ...
##  $ Acc030   : num  4.4 3.7 3.5 4.4 4 3.4 3.7 3.9 3.4 3.9 ...
##  $ Acc060   : num  12.8 10.3 9.5 12.1 10.9 9.3 9.8 9.5 9.2 10.8 ...
##  $ QtrMile  : num  19.4 17.8 17.3 19 18.2 17.2 17.6 17.4 17.1 18.3 ...
##  $ PageNum  : int  123 148 163 188 196 128 119 131 136 216 ...
##  $ Size     : chr  "Small" "Small" "Small" "Small" ...

View Data:

dim(cars)
## [1] 110  20
head(cars)
tail(cars)
glimpse(cars)
## Rows: 110
## Columns: 20
## $ Make      <chr> "Chevrolet", "Hyundai", "Kia", "Mitsubishi", "Nissan", "Dodg…
## $ Model     <chr> "Spark", "Accent", "Rio", "Mirage", "Versa Note", "Dart", "C…
## $ Type      <chr> "Hatchback", "Hatchback", "Sedan", "Hatchback", "Hatchback",…
## $ LowPrice  <dbl> 12.270, 14.745, 13.990, 12.995, 14.180, 16.495, 16.170, 19.3…
## $ HighPrice <dbl> 25.560, 17.495, 18.290, 15.395, 17.960, 23.795, 25.660, 24.6…
## $ Drive     <chr> "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD…
## $ CityMPG   <int> 30, 28, 28, 37, 31, 23, 24, 24, 28, 30, 27, 27, 25, 27, 30, …
## $ HwyMPG    <int> 39, 37, 36, 44, 40, 35, 36, 33, 38, 35, 33, 36, 36, 37, 39, …
## $ FuelCap   <dbl> 9.0, 11.4, 11.3, 9.2, 10.9, 14.2, 15.6, 13.1, 12.4, 11.1, 11…
## $ Length    <int> 145, 172, 172, 149, 164, 184, 181, 167, 179, 154, 156, 180, …
## $ Width     <int> 63, 67, 68, 66, 67, 72, 71, 70, 72, 67, 68, 69, 70, 68, 69, …
## $ Wheelbase <int> 94, 101, 101, 97, 102, 106, 106, 103, 104, 99, 98, 104, 104,…
## $ Height    <int> 61, 57, 57, 59, 61, 58, 58, 66, 58, 59, 58, 58, 57, 58, 59, …
## $ UTurn     <int> 34, 37, 37, 32, 37, 38, 38, 37, 39, 34, 35, 38, 37, 36, 37, …
## $ Weight    <int> 2345, 2550, 2575, 2085, 2470, 3260, 3140, 3330, 2990, 2385, …
## $ Acc030    <dbl> 4.4, 3.7, 3.5, 4.4, 4.0, 3.4, 3.7, 3.9, 3.4, 3.9, 3.9, 3.7, …
## $ Acc060    <dbl> 12.8, 10.3, 9.5, 12.1, 10.9, 9.3, 9.8, 9.5, 9.2, 10.8, 11.1,…
## $ QtrMile   <dbl> 19.4, 17.8, 17.3, 19.0, 18.2, 17.2, 17.6, 17.4, 17.1, 18.3, …
## $ PageNum   <int> 123, 148, 163, 188, 196, 128, 119, 131, 136, 216, 179, 205, …
## $ Size      <chr> "Small", "Small", "Small", "Small", "Small", "Small", "Small…

In this analysis, I’m going to look for an association between Drive and Size. Drive should be categorical (factor), but is improperly assigned as a character variable. Size should be categorical (factor), but is improperly assigned as a character variable. I will change the data type in the below.

Show the code for variable extraction and clean-up: First step: extract the variables that I want to use and assign to a dataframe. Second step: retain only observations with values for both variables Third step: transform Drive to factor Fourth step: transform Size to factor Fifth step: view the results

mydata<- cars %>% 
  select(Drive, Size)%>%
  filter(!is.na(Drive), !is.na(Size))
 glimpse(mydata)
## Rows: 110
## Columns: 2
## $ Drive <chr> "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "…
## $ Size  <chr> "Small", "Small", "Small", "Small", "Small", "Small", "Small", "…
 class(mydata$Drive)
## [1] "character"
 class(mydata$Size)
## [1] "character"
mydata$Drive <- as.factor(mydata$Drive)
class(mydata$Drive)
## [1] "factor"
levels(mydata$Drive)
## [1] "AWD" "FWD" "RWD"
mydata$Size <- as.factor(mydata$Size)
class(mydata$Size)
## [1] "factor"
levels(mydata$Size)
## [1] "Large"    "Midsized" "Small"
head(mydata)

Create a table from the data (mydata):

mytable<- table(mydata$Drive, mydata$Size)
mytable
##      
##       Large Midsized Small
##   AWD     7        9     9
##   FWD    13       20    30
##   RWD     9        5     8

Determine whether the data meets the conditions for performing a chi-square test of independence: 1: Independence, means each case that contributes a count to the table must be independent of all the other cases in the table. The data meets the independence condition. 2: Sample size, each particular cell must have at least 5 cases. The data meets the sample size condition. 3: degree of freedom, d.f should grater than 1. The data meets the d.f condition.

Apply the chisq test to the table:

chisq.test(mytable)
## 
##  Pearson's Chi-squared test
## 
## data:  mytable
## X-squared = 4.1017, df = 4, p-value = 0.3924

Discussion/Interprettion: 1: explanatory variable: Drive (type of drive); response variable: Size (the size of a car). 2: Conditions: a: Independence, means each case that contributes a count to the table must be independent of all the other cases in the table. The data meets the independence condition because each case is independent of other cases in the table. b: Sample size, each particular cell must have at least 5 cases. Each cell have at least 5 cases in the contingency table, so the data meets the sample size condition. c: degree of freedom, d.f should grater than 1. The data meets the d.f condition, d.f=(3-1)*(3-1)=4. 3: State Ho and Ha Ho: The type of drive and the size of a car are independent (no association). Ha: The type of drive and the size of a car are dependent (association). 4: X-squared = 4.1017, p-value = 0.3924, p-value > alpha=0.05, so fail to reject the null hypothesis. 5: There is no significant evidence to conclude that there is an association between the type of a drive and the size of the car. 6: Limitation: the data meets all the conditions for Chi-square Test of Independence, but the sample size (110) is still small comparing to all cars in the year of 2015, so the current sample size is not representative enough for all cars.

Analysis 2: [Analysis of Variance]

Analyst:[Onyekachi Igwenagu]

Analysis 2 Topic: A test using the variables “Make and”FuelCap“. The”Make" variable has upto two catagories: Acura, Chevrolet

Now install the packages neeeded in order to complete our analysis.

library (dplyr)
library (sjstats)
library (car)
library (pwr)

Load in our data into R

cars <- read.csv("./Cars2015.csv", header=T)
cars

Looking theought the the contents in the data.

mycat<- cars %>% 
select(FuelCap, Make)%>%
filter(!is.na(FuelCap), !is.na(Make))
head(cars)
attach(cars)
glimpse(cars)
## Rows: 110
## Columns: 20
## $ Make      <chr> "Chevrolet", "Hyundai", "Kia", "Mitsubishi", "Nissan", "Dodg…
## $ Model     <chr> "Spark", "Accent", "Rio", "Mirage", "Versa Note", "Dart", "C…
## $ Type      <chr> "Hatchback", "Hatchback", "Sedan", "Hatchback", "Hatchback",…
## $ LowPrice  <dbl> 12.270, 14.745, 13.990, 12.995, 14.180, 16.495, 16.170, 19.3…
## $ HighPrice <dbl> 25.560, 17.495, 18.290, 15.395, 17.960, 23.795, 25.660, 24.6…
## $ Drive     <chr> "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD", "FWD…
## $ CityMPG   <int> 30, 28, 28, 37, 31, 23, 24, 24, 28, 30, 27, 27, 25, 27, 30, …
## $ HwyMPG    <int> 39, 37, 36, 44, 40, 35, 36, 33, 38, 35, 33, 36, 36, 37, 39, …
## $ FuelCap   <dbl> 9.0, 11.4, 11.3, 9.2, 10.9, 14.2, 15.6, 13.1, 12.4, 11.1, 11…
## $ Length    <int> 145, 172, 172, 149, 164, 184, 181, 167, 179, 154, 156, 180, …
## $ Width     <int> 63, 67, 68, 66, 67, 72, 71, 70, 72, 67, 68, 69, 70, 68, 69, …
## $ Wheelbase <int> 94, 101, 101, 97, 102, 106, 106, 103, 104, 99, 98, 104, 104,…
## $ Height    <int> 61, 57, 57, 59, 61, 58, 58, 66, 58, 59, 58, 58, 57, 58, 59, …
## $ UTurn     <int> 34, 37, 37, 32, 37, 38, 38, 37, 39, 34, 35, 38, 37, 36, 37, …
## $ Weight    <int> 2345, 2550, 2575, 2085, 2470, 3260, 3140, 3330, 2990, 2385, …
## $ Acc030    <dbl> 4.4, 3.7, 3.5, 4.4, 4.0, 3.4, 3.7, 3.9, 3.4, 3.9, 3.9, 3.7, …
## $ Acc060    <dbl> 12.8, 10.3, 9.5, 12.1, 10.9, 9.3, 9.8, 9.5, 9.2, 10.8, 11.1,…
## $ QtrMile   <dbl> 19.4, 17.8, 17.3, 19.0, 18.2, 17.2, 17.6, 17.4, 17.1, 18.3, …
## $ PageNum   <int> 123, 148, 163, 188, 196, 128, 119, 131, 136, 216, 179, 205, …
## $ Size      <chr> "Small", "Small", "Small", "Small", "Small", "Small", "Small…
dim(cars)
## [1] 110  20
str(cars)
## 'data.frame':    110 obs. of  20 variables:
##  $ Make     : chr  "Chevrolet" "Hyundai" "Kia" "Mitsubishi" ...
##  $ Model    : chr  "Spark" "Accent" "Rio" "Mirage" ...
##  $ Type     : chr  "Hatchback" "Hatchback" "Sedan" "Hatchback" ...
##  $ LowPrice : num  12.3 14.7 14 13 14.2 ...
##  $ HighPrice: num  25.6 17.5 18.3 15.4 18 ...
##  $ Drive    : chr  "FWD" "FWD" "FWD" "FWD" ...
##  $ CityMPG  : int  30 28 28 37 31 23 24 24 28 30 ...
##  $ HwyMPG   : int  39 37 36 44 40 35 36 33 38 35 ...
##  $ FuelCap  : num  9 11.4 11.3 9.2 10.9 14.2 15.6 13.1 12.4 11.1 ...
##  $ Length   : int  145 172 172 149 164 184 181 167 179 154 ...
##  $ Width    : int  63 67 68 66 67 72 71 70 72 67 ...
##  $ Wheelbase: int  94 101 101 97 102 106 106 103 104 99 ...
##  $ Height   : int  61 57 57 59 61 58 58 66 58 59 ...
##  $ UTurn    : int  34 37 37 32 37 38 38 37 39 34 ...
##  $ Weight   : int  2345 2550 2575 2085 2470 3260 3140 3330 2990 2385 ...
##  $ Acc030   : num  4.4 3.7 3.5 4.4 4 3.4 3.7 3.9 3.4 3.9 ...
##  $ Acc060   : num  12.8 10.3 9.5 12.1 10.9 9.3 9.8 9.5 9.2 10.8 ...
##  $ QtrMile  : num  19.4 17.8 17.3 19 18.2 17.2 17.6 17.4 17.1 18.3 ...
##  $ PageNum  : int  123 148 163 188 196 128 119 131 136 216 ...
##  $ Size     : chr  "Small" "Small" "Small" "Small" ...

Im looking for the relationship between the variiables FuelCap and Make for in the data.Looking for a chaningin difference in the mean and standard deviation. The potentical catagorical explantory variable is Make and the quntitaive response variable is the FuelCap.

head(mycat)
names(mycat)
## [1] "FuelCap" "Make"
str(mycat)
## 'data.frame':    110 obs. of  2 variables:
##  $ FuelCap: num  9 11.4 11.3 9.2 10.9 14.2 15.6 13.1 12.4 11.1 ...
##  $ Make   : chr  "Chevrolet" "Hyundai" "Kia" "Mitsubishi" ...
summary(mycat)
##     FuelCap          Make          
##  Min.   : 9.00   Length:110        
##  1st Qu.:14.65   Class :character  
##  Median :18.50   Mode  :character  
##  Mean   :18.00                     
##  3rd Qu.:19.73                     
##  Max.   :33.50
sd(mycat$FuelCap)
## [1] 4.374224
tapply (mycat$FuelCap, mycat$Make, mean)
##      Acura       Audi        BMW      Buick     Buick    Cadillac  Chevrolet 
##   19.00000   17.51667   17.42000   19.73333   14.00000   20.12500   19.60000 
## Chevrolet    Chrysler      Dodge     Dodge        Fiat       Ford      Ford  
##   15.60000   18.10000   19.60000   19.16667   13.10000   18.70000   12.40000 
##       GMC      Honda     Hyundai   Infiniti     Jaguar       Jeep        Kia 
##   29.50000   19.42500   16.81429   21.90000   20.25000   19.10000   15.16000 
## Land Rover      Lexus    Lincoln   Maserati      Mazda     Mazda    Mercedes 
##   18.10000   19.80000   21.75000   21.00000   13.46667   12.70000   17.95000 
## Mitsubishi     Nissan     Porche      Scion     Subaru    Subaru      Toyoto 
##    9.20000   16.03333   16.90000   14.25000   16.30000   18.50000   19.32857 
## Volkswagon      Volvo 
##   15.40000   18.15000
tapply (mycat$FuelCap, mycat$Make, sd)
##      Acura       Audi        BMW      Buick     Buick    Cadillac  Chevrolet 
##  0.7071068  3.8592314  2.7976776  1.9629909         NA  4.0901304  5.4203321 
## Chevrolet    Chrysler      Dodge     Dodge        Fiat       Ford      Ford  
##         NA  2.1283797  7.6367532  0.7637626         NA  6.8925080         NA 
##       GMC      Honda     Hyundai   Infiniti     Jaguar       Jeep        Kia 
##  4.9497475  1.8945096  3.3711663  2.6870058  1.2020815  7.7781746  3.2323366 
## Land Rover      Lexus    Lincoln   Maserati      Mazda     Mazda    Mercedes 
##         NA  3.2526912  8.8388348         NA  2.3115651         NA  0.7778175 
## Mitsubishi     Nissan     Porche      Scion     Subaru    Subaru      Toyoto 
##         NA  3.6822095  0.0000000  0.3535534  2.0297783         NA  4.8606290 
## Volkswagon      Volvo 
##  2.7622455  0.4949747
tapply (mycat$FuelCap, mycat$Make, summary)
## $Acura
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   18.50   18.75   19.00   19.00   19.25   19.50 
## 
## $Audi
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   13.20   14.90   16.90   17.52   19.27   23.80 
## 
## $BMW
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   14.50   15.80   16.60   17.42   18.50   21.70 
## 
## $Buick
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   18.60   18.60   18.60   19.73   20.30   22.00 
## 
## $`Buick `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##      14      14      14      14      14      14 
## 
## $Cadillac
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   16.50   18.38   19.00   20.12   20.75   26.00 
## 
## $Chevrolet
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    9.00   18.38   18.65   19.60   23.00   26.00 
## 
## $`Chevrolet `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    15.6    15.6    15.6    15.6    15.6    15.6 
## 
## $Chrysler
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   15.80   17.15   18.50   18.10   19.25   20.00 
## 
## $Dodge
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    14.2    16.9    19.6    19.6    22.3    25.0 
## 
## $`Dodge `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   18.50   18.75   19.00   19.17   19.50   20.00 
## 
## $Fiat
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    13.1    13.1    13.1    13.1    13.1    13.1 
## 
## $Ford
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   12.40   15.45   16.50   18.70   18.80   33.50 
## 
## $`Ford `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    12.4    12.4    12.4    12.4    12.4    12.4 
## 
## $`GMC `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   26.00   27.75   29.50   29.50   31.25   33.00 
## 
## $`Honda `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   17.20   18.18   19.75   19.43   21.00   21.00 
## 
## $Hyundai
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   11.40   15.00   18.50   16.81   18.75   20.30 
## 
## $Infiniti
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   20.00   20.95   21.90   21.90   22.85   23.80 
## 
## $Jaguar
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.40   19.82   20.25   20.25   20.68   21.10 
## 
## $Jeep
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   13.60   16.35   19.10   19.10   21.85   24.60 
## 
## $Kia
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   11.30   13.20   14.30   15.16   18.50   18.50 
## 
## $`Land Rover`
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    18.1    18.1    18.1    18.1    18.1    18.1 
## 
## $Lexus
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   17.50   18.65   19.80   19.80   20.95   22.10 
## 
## $Lincoln
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   15.50   18.62   21.75   21.75   24.88   28.00 
## 
## $Maserati
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##      21      21      21      21      21      21 
## 
## $Mazda
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   11.30   12.25   13.20   13.47   14.55   15.90 
## 
## $`Mazda `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    12.7    12.7    12.7    12.7    12.7    12.7 
## 
## $Mercedes
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   17.40   17.68   17.95   17.95   18.23   18.50 
## 
## $Mitsubishi
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     9.2     9.2     9.2     9.2     9.2     9.2 
## 
## $Nissan
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   10.90   13.60   16.25   16.03   19.12   20.00 
## 
## $Porche
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    16.9    16.9    16.9    16.9    16.9    16.9 
## 
## $Scion
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   14.00   14.12   14.25   14.25   14.38   14.50 
## 
## $Subaru
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    14.5    15.2    15.9    16.3    17.2    18.5 
## 
## $`Subaru `
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    18.5    18.5    18.5    18.5    18.5    18.5 
## 
## $Toyoto
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   11.10   17.35   19.20   19.33   21.95   26.40 
## 
## $Volkswagon
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   13.20   13.85   14.50   15.40   16.50   18.50 
## 
## $Volvo
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   17.80   17.98   18.15   18.15   18.32   18.50
group_by(cars, Make) %>%
summarise(
count = n(),
mean = mean(FuelCap, na.rm = TRUE),
sd = sd(FuelCap, na.rm = TRUE))
summary(mycat)
##     FuelCap          Make          
##  Min.   : 9.00   Length:110        
##  1st Qu.:14.65   Class :character  
##  Median :18.50   Mode  :character  
##  Mean   :18.00                     
##  3rd Qu.:19.73                     
##  Max.   :33.50

After summarizing the variables and looking at the graph, there looks to not be a difference in the means of the sample size..

qqnorm(mycat$FuelCap)
qqline(mycat$FuelCap)

aov(mycat$FuelCap~mycat$Make, data = mycat)
## Call:
##    aov(formula = mycat$FuelCap ~ mycat$Make, data = mycat)
## 
## Terms:
##                 mycat$Make Residuals
## Sum of Squares    814.3432 1271.2445
## Deg. of Freedom         36        73
## 
## Residual standard error: 4.173045
## Estimated effects may be unbalanced
anova.all = aov(mycat$FuelCap~mycat$Make, data = mycat)
summary(anova.all)
##             Df Sum Sq Mean Sq F value Pr(>F)
## mycat$Make  36  814.3   22.62   1.299  0.171
## Residuals   73 1271.2   17.41
TukeyHSD(anova.all)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = mycat$FuelCap ~ mycat$Make, data = mycat)
## 
## $`mycat$Make`
##                                diff        lwr        upr     p adj
## Audi-Acura            -1.483333e+00 -15.164991 12.1983242 1.0000000
## BMW-Acura             -1.580000e+00 -15.599527 12.4395272 1.0000000
## Buick-Acura            7.333333e-01 -14.563225 16.0298915 1.0000000
## Buick -Acura          -5.000000e+00 -25.522486 15.5224864 1.0000000
## Cadillac-Acura         1.125000e+00 -13.386589 15.6365893 1.0000000
## Chevrolet-Acura        6.000000e-01 -12.647208 13.8472080 1.0000000
## Chevrolet -Acura      -3.400000e+00 -23.922486 17.1224864 1.0000000
## Chrysler-Acura        -9.000000e-01 -16.196558 14.3965582 1.0000000
## Dodge-Acura            6.000000e-01 -16.156540 17.3565399 1.0000000
## Dodge -Acura           1.666667e-01 -15.129892 15.4632249 1.0000000
## Fiat-Acura            -5.900000e+00 -26.422486 14.6224864 0.9999998
## Ford-Acura            -3.000000e-01 -13.735121 13.1351210 1.0000000
## Ford -Acura           -6.600000e+00 -27.122486 13.9224864 0.9999973
## GMC -Acura             1.050000e+01  -6.256540 27.2565399 0.8350995
## Honda -Acura           4.250000e-01 -14.086589 14.9365893 1.0000000
## Hyundai-Acura         -2.185714e+00 -15.620835 11.2494067 1.0000000
## Infiniti-Acura         2.900000e+00 -13.856540 19.6565399 1.0000000
## Jaguar-Acura           1.250000e+00 -15.506540 18.0065399 1.0000000
## Jeep-Acura             1.000000e-01 -16.656540 16.8565399 1.0000000
## Kia-Acura             -3.840000e+00 -17.859527 10.1795272 1.0000000
## Land Rover-Acura      -9.000000e-01 -21.422486 19.6224864 1.0000000
## Lexus-Acura            8.000000e-01 -15.956540 17.5565399 1.0000000
## Lincoln-Acura          2.750000e+00 -14.006540 19.5065399 1.0000000
## Maserati-Acura         2.000000e+00 -18.522486 22.5224864 1.0000000
## Mazda-Acura           -5.533333e+00 -20.829892  9.7632249 0.9999605
## Mazda -Acura          -6.300000e+00 -26.822486 14.2224864 0.9999991
## Mercedes-Acura        -1.050000e+00 -17.806540 15.7065399 1.0000000
## Mitsubishi-Acura      -9.800000e+00 -30.322486 10.7224864 0.9932769
## Nissan-Acura          -2.966667e+00 -16.648324 10.7149909 1.0000000
## Porche-Acura          -2.100000e+00 -18.856540 14.6565399 1.0000000
## Scion-Acura           -4.750000e+00 -21.506540 12.0065399 0.9999999
## Subaru-Acura          -2.700000e+00 -17.996558 12.5965582 1.0000000
## Subaru -Acura         -5.000000e-01 -21.022486 20.0224864 1.0000000
## Toyoto-Acura           3.285714e-01 -13.106550 13.7636925 1.0000000
## Volkswagon-Acura      -3.600000e+00 -18.896558 11.6965582 1.0000000
## Volvo-Acura           -8.500000e-01 -17.606540 15.9065399 1.0000000
## BMW-Audi              -9.666667e-02 -10.243255 10.0499222 1.0000000
## Buick-Audi             2.216667e+00  -9.631996 14.0653297 1.0000000
## Buick -Audi           -3.516667e+00 -21.615798 14.5824651 1.0000000
## Cadillac-Audi          2.608333e+00  -8.207967 13.4246334 1.0000000
## Chevrolet-Audi         2.083333e+00  -6.966233 11.1328992 1.0000000
## Chevrolet -Audi       -1.916667e+00 -20.015798 16.1824651 1.0000000
## Chrysler-Audi          5.833333e-01 -11.265330 12.4319964 1.0000000
## Dodge-Audi             2.083333e+00 -11.598324 15.7649909 1.0000000
## Dodge -Audi            1.650000e+00 -10.198663 13.4986630 1.0000000
## Fiat-Audi             -4.416667e+00 -22.515798 13.6824651 1.0000000
## Ford-Audi              1.183333e+00  -8.139145 10.5058115 1.0000000
## Ford -Audi            -5.116667e+00 -23.215798 12.9824651 0.9999999
## GMC -Audi              1.198333e+01  -1.698324 25.6649909 0.1842133
## Honda -Audi            1.908333e+00  -8.907967 12.7246334 1.0000000
## Hyundai-Audi          -7.023810e-01 -10.024859  8.6200973 1.0000000
## Infiniti-Audi          4.383333e+00  -9.298324 18.0649909 0.9999975
## Jaguar-Audi            2.733333e+00 -10.948324 16.4149909 1.0000000
## Jeep-Audi              1.583333e+00 -12.098324 15.2649909 1.0000000
## Kia-Audi              -2.356667e+00 -12.503255  7.7899222 1.0000000
## Land Rover-Audi        5.833333e-01 -17.515798 18.6824651 1.0000000
## Lexus-Audi             2.283333e+00 -11.398324 15.9649909 1.0000000
## Lincoln-Audi           4.233333e+00  -9.448324 17.9149909 0.9999989
## Maserati-Audi          3.483333e+00 -14.615798 21.5824651 1.0000000
## Mazda-Audi            -4.050000e+00 -15.898663  7.7986630 0.9999888
## Mazda -Audi           -4.816667e+00 -22.915798 13.2824651 1.0000000
## Mercedes-Audi          4.333333e-01 -13.248324 14.1149909 1.0000000
## Mitsubishi-Audi       -8.316667e+00 -26.415798  9.7824651 0.9963206
## Nissan-Audi           -1.483333e+00 -11.157726  8.1910595 1.0000000
## Porche-Audi           -6.166667e-01 -14.298324 13.0649909 1.0000000
## Scion-Audi            -3.266667e+00 -16.948324 10.4149909 1.0000000
## Subaru-Audi           -1.216667e+00 -13.065330 10.6319964 1.0000000
## Subaru -Audi           9.833333e-01 -17.115798 19.0824651 1.0000000
## Toyoto-Audi            1.811905e+00  -7.510573 11.1343830 1.0000000
## Volkswagon-Audi       -2.116667e+00 -13.965330  9.7319964 1.0000000
## Volvo-Audi             6.333333e-01 -13.048324 14.3149909 1.0000000
## Buick-BMW              2.313333e+00  -9.923913 14.5505799 1.0000000
## Buick -BMW            -3.420000e+00 -21.775870 14.9358698 1.0000000
## Cadillac-BMW           2.705000e+00  -8.535629 13.9456287 1.0000000
## Chevrolet-BMW          2.180000e+00  -7.372698 11.7326975 1.0000000
## Chevrolet -BMW        -1.820000e+00 -20.175870 16.5358698 1.0000000
## Chrysler-BMW           6.800000e-01 -11.557247 12.9172466 1.0000000
## Dodge-BMW              2.180000e+00 -11.839527 16.1995272 1.0000000
## Dodge -BMW             1.746667e+00 -10.490580 13.9839132 1.0000000
## Fiat-BMW              -4.320000e+00 -22.675870 14.0358698 1.0000000
## Ford-BMW               1.280000e+00  -8.531625 11.0916251 1.0000000
## Ford -BMW             -5.020000e+00 -23.375870 13.3358698 1.0000000
## GMC -BMW               1.208000e+01  -1.939527 26.0995272 0.2096684
## Honda -BMW             2.005000e+00  -9.235629 13.2456287 1.0000000
## Hyundai-BMW           -6.057143e-01 -10.417339  9.2059108 1.0000000
## Infiniti-BMW           4.480000e+00  -9.539527 18.4995272 0.9999977
## Jaguar-BMW             2.830000e+00 -11.189527 16.8495272 1.0000000
## Jeep-BMW               1.680000e+00 -12.339527 15.6995272 1.0000000
## Kia-BMW               -2.260000e+00 -12.857766  8.3377664 1.0000000
## Land Rover-BMW         6.800000e-01 -17.675870 19.0358698 1.0000000
## Lexus-BMW              2.380000e+00 -11.639527 16.3995272 1.0000000
## Lincoln-BMW            4.330000e+00  -9.689527 18.3495272 0.9999990
## Maserati-BMW           3.580000e+00 -14.775870 21.9358698 1.0000000
## Mazda-BMW             -3.953333e+00 -16.190580  8.2839132 0.9999970
## Mazda -BMW            -4.720000e+00 -23.075870 13.6358698 1.0000000
## Mercedes-BMW           5.300000e-01 -13.489527 14.5495272 1.0000000
## Mitsubishi-BMW        -8.220000e+00 -26.575870 10.1358698 0.9975928
## Nissan-BMW            -1.386667e+00 -11.533255  8.7599222 1.0000000
## Porche-BMW            -5.200000e-01 -14.539527 13.4995272 1.0000000
## Scion-BMW             -3.170000e+00 -17.189527 10.8495272 1.0000000
## Subaru-BMW            -1.120000e+00 -13.357247 11.1172466 1.0000000
## Subaru -BMW            1.080000e+00 -17.275870 19.4358698 1.0000000
## Toyoto-BMW             1.908571e+00  -7.903054 11.7201966 1.0000000
## Volkswagon-BMW        -2.020000e+00 -14.257247 10.2172466 1.0000000
## Volvo-BMW              7.300000e-01 -13.289527 14.7495272 1.0000000
## Buick -Buick          -5.733333e+00 -25.082119 13.6154524 0.9999996
## Cadillac-Buick         3.916667e-01 -12.406352 13.1896854 1.0000000
## Chevrolet-Buick       -1.333333e-01 -11.477565 11.2108978 1.0000000
## Chevrolet -Buick      -4.133333e+00 -23.482119 15.2154524 1.0000000
## Chrysler-Buick        -1.633333e+00 -15.314991 12.0483242 1.0000000
## Dodge-Buick           -1.333333e-01 -15.429892 15.1632249 1.0000000
## Dodge -Buick          -5.666667e-01 -14.248324 13.1149909 1.0000000
## Fiat-Buick            -6.633333e+00 -25.982119 12.7154524 0.9999880
## Ford-Buick            -1.033333e+00 -12.596444 10.5297778 1.0000000
## Ford -Buick           -7.333333e+00 -26.682119 12.0154524 0.9998942
## GMC -Buick             9.766667e+00  -5.529892 25.0632249 0.8078570
## Honda -Buick          -3.083333e-01 -13.106352 12.4896854 1.0000000
## Hyundai-Buick         -2.919048e+00 -14.482159  8.6440635 1.0000000
## Infiniti-Buick         2.166667e+00 -13.129892 17.4632249 1.0000000
## Jaguar-Buick           5.166667e-01 -14.779892 15.8132249 1.0000000
## Jeep-Buick            -6.333333e-01 -15.929892 14.6632249 1.0000000
## Kia-Buick             -4.573333e+00 -16.810580  7.6639132 0.9999209
## Land Rover-Buick      -1.633333e+00 -20.982119 17.7154524 1.0000000
## Lexus-Buick            6.666667e-02 -15.229892 15.3632249 1.0000000
## Lincoln-Buick          2.016667e+00 -13.279892 17.3132249 1.0000000
## Maserati-Buick         1.266667e+00 -18.082119 20.6154524 1.0000000
## Mazda-Buick           -6.266667e+00 -19.948324  7.4149909 0.9965069
## Mazda -Buick          -7.033333e+00 -26.382119 12.3154524 0.9999561
## Mercedes-Buick        -1.783333e+00 -17.079892 13.5132249 1.0000000
## Mitsubishi-Buick      -1.053333e+01 -29.882119  8.8154524 0.9602990
## Nissan-Buick          -3.700000e+00 -15.548663  8.1486630 0.9999987
## Porche-Buick          -2.833333e+00 -18.129892 12.4632249 1.0000000
## Scion-Buick           -5.483333e+00 -20.779892  9.8132249 0.9999675
## Subaru-Buick          -3.433333e+00 -17.114991 10.2483242 1.0000000
## Subaru -Buick         -1.233333e+00 -20.582119 18.1154524 1.0000000
## Toyoto-Buick          -4.047619e-01 -11.967873 11.1583492 1.0000000
## Volkswagon-Buick      -4.333333e+00 -18.014991  9.3483242 0.9999981
## Volvo-Buick           -1.583333e+00 -16.879892 13.7132249 1.0000000
## Cadillac-Buick         6.125000e+00 -12.609381 24.8593812 0.9999960
## Chevrolet-Buick        5.600000e+00 -12.172995 23.3729945 0.9999983
## Chevrolet -Buick       1.600000e+00 -22.097326 25.2973260 1.0000000
## Chrysler-Buick         4.100000e+00 -15.248786 23.4487857 1.0000000
## Dodge-Buick            5.600000e+00 -14.922486 26.1224864 1.0000000
## Dodge -Buick           5.166667e+00 -14.182119 24.5154524 1.0000000
## Fiat-Buick            -9.000000e-01 -24.597326 22.7973260 1.0000000
## Ford-Buick             4.700000e+00 -13.213495 22.6134947 1.0000000
## Ford -Buick           -1.600000e+00 -25.297326 22.0973260 1.0000000
## GMC -Buick             1.550000e+01  -5.022486 36.0224864 0.4726258
## Honda -Buick           5.425000e+00 -13.309381 24.1593812 0.9999998
## Hyundai-Buick          2.814286e+00 -15.099209 20.7277804 1.0000000
## Infiniti-Buick         7.900000e+00 -12.622486 28.4224864 0.9998546
## Jaguar-Buick           6.250000e+00 -14.272486 26.7724864 0.9999993
## Jeep-Buick             5.100000e+00 -15.422486 25.6224864 1.0000000
## Kia-Buick              1.160000e+00 -17.195870 19.5158698 1.0000000
## Land Rover-Buick       4.100000e+00 -19.597326 27.7973260 1.0000000
## Lexus-Buick            5.800000e+00 -14.722486 26.3224864 0.9999999
## Lincoln-Buick          7.750000e+00 -12.772486 28.2724864 0.9999018
## Maserati-Buick         7.000000e+00 -16.697326 30.6973260 0.9999997
## Mazda-Buick           -5.333333e-01 -19.882119 18.8154524 1.0000000
## Mazda -Buick          -1.300000e+00 -24.997326 22.3973260 1.0000000
## Mercedes-Buick         3.950000e+00 -16.572486 24.4724864 1.0000000
## Mitsubishi-Buick      -4.800000e+00 -28.497326 18.8973260 1.0000000
## Nissan-Buick           2.033333e+00 -16.065798 20.1324651 1.0000000
## Porche-Buick           2.900000e+00 -17.622486 23.4224864 1.0000000
## Scion-Buick            2.500000e-01 -20.272486 20.7724864 1.0000000
## Subaru-Buick           2.300000e+00 -17.048786 21.6487857 1.0000000
## Subaru -Buick          4.500000e+00 -19.197326 28.1973260 1.0000000
## Toyoto-Buick           5.328571e+00 -12.584923 23.2420661 0.9999996
## Volkswagon-Buick       1.400000e+00 -17.948786 20.7487857 1.0000000
## Volvo-Buick            4.150000e+00 -16.372486 24.6724864 1.0000000
## Chevrolet-Cadillac    -5.250000e-01 -10.786243  9.7362432 1.0000000
## Chevrolet -Cadillac   -4.525000e+00 -23.259381 14.2093812 1.0000000
## Chrysler-Cadillac     -2.025000e+00 -14.823019 10.7730188 1.0000000
## Dodge-Cadillac        -5.250000e-01 -15.036589 13.9865893 1.0000000
## Dodge -Cadillac       -9.583333e-01 -13.756352 11.8396854 1.0000000
## Fiat-Cadillac         -7.025000e+00 -25.759381 11.7093812 0.9999152
## Ford-Cadillac         -1.425000e+00 -11.927717  9.0777172 1.0000000
## Ford -Cadillac        -7.725000e+00 -26.459381 11.0093812 0.9994439
## GMC -Cadillac          9.375000e+00  -5.136589 23.8865893 0.7894542
## Honda -Cadillac       -7.000000e-01 -12.548663 11.1486630 1.0000000
## Hyundai-Cadillac      -3.310714e+00 -13.813432  7.1920029 0.9999983
## Infiniti-Cadillac      1.775000e+00 -12.736589 16.2865893 1.0000000
## Jaguar-Cadillac        1.250000e-01 -14.386589 14.6365893 1.0000000
## Jeep-Cadillac         -1.025000e+00 -15.536589 13.4865893 1.0000000
## Kia-Cadillac          -4.965000e+00 -16.205629  6.2756287 0.9980927
## Land Rover-Cadillac   -2.025000e+00 -20.759381 16.7093812 1.0000000
## Lexus-Cadillac        -3.250000e-01 -14.836589 14.1865893 1.0000000
## Lincoln-Cadillac       1.625000e+00 -12.886589 16.1365893 1.0000000
## Maserati-Cadillac      8.750000e-01 -17.859381 19.6093812 1.0000000
## Mazda-Cadillac        -6.658333e+00 -19.456352  6.1396854 0.9774411
## Mazda -Cadillac       -7.425000e+00 -26.159381 11.3093812 0.9997399
## Mercedes-Cadillac     -2.175000e+00 -16.686589 12.3365893 1.0000000
## Mitsubishi-Cadillac   -1.092500e+01 -29.659381  7.8093812 0.9152677
## Nissan-Cadillac       -4.091667e+00 -14.907967  6.7246334 0.9998982
## Porche-Cadillac       -3.225000e+00 -17.736589 11.2865893 1.0000000
## Scion-Cadillac        -5.875000e+00 -20.386589  8.6365893 0.9996071
## Subaru-Cadillac       -3.825000e+00 -16.623019  8.9730188 0.9999996
## Subaru -Cadillac      -1.625000e+00 -20.359381 17.1093812 1.0000000
## Toyoto-Cadillac       -7.964286e-01 -11.299146  9.7062887 1.0000000
## Volkswagon-Cadillac   -4.725000e+00 -17.523019  8.0730188 0.9999388
## Volvo-Cadillac        -1.975000e+00 -16.486589 12.5365893 1.0000000
## Chevrolet -Chevrolet  -4.000000e+00 -21.772995 13.7729945 1.0000000
## Chrysler-Chevrolet    -1.500000e+00 -12.844231  9.8442312 1.0000000
## Dodge-Chevrolet        1.421085e-14 -13.247208 13.2472080 1.0000000
## Dodge -Chevrolet      -4.333333e-01 -11.777565 10.9108978 1.0000000
## Fiat-Chevrolet        -6.500000e+00 -24.272995 11.2729945 0.9999500
## Ford-Chevrolet        -9.000000e-01  -9.572333  7.7723333 1.0000000
## Ford -Chevrolet       -7.200000e+00 -24.972995 10.5729945 0.9996023
## GMC -Chevrolet         9.900000e+00  -3.347208 23.1472080 0.4962208
## Honda -Chevrolet      -1.750000e-01 -10.436243 10.0862432 1.0000000
## Hyundai-Chevrolet     -2.785714e+00 -11.458048  5.8866190 0.9999974
## Infiniti-Chevrolet     2.300000e+00 -10.947208 15.5472080 1.0000000
## Jaguar-Chevrolet       6.500000e-01 -12.597208 13.8972080 1.0000000
## Jeep-Chevrolet        -5.000000e-01 -13.747208 12.7472080 1.0000000
## Kia-Chevrolet         -4.440000e+00 -13.992698  5.1126975 0.9955818
## Land Rover-Chevrolet  -1.500000e+00 -19.272995 16.2729945 1.0000000
## Lexus-Chevrolet        2.000000e-01 -13.047208 13.4472080 1.0000000
## Lincoln-Chevrolet      2.150000e+00 -11.097208 15.3972080 1.0000000
## Maserati-Chevrolet     1.400000e+00 -16.372995 19.1729945 1.0000000
## Mazda-Chevrolet       -6.133333e+00 -17.477565  5.2108978 0.9634428
## Mazda -Chevrolet      -6.900000e+00 -24.672995 10.8729945 0.9998274
## Mercedes-Chevrolet    -1.650000e+00 -14.897208 11.5972080 1.0000000
## Mitsubishi-Chevrolet  -1.040000e+01 -28.172995  7.3729945 0.9122751
## Nissan-Chevrolet      -3.566667e+00 -12.616233  5.4828992 0.9997669
## Porche-Chevrolet      -2.700000e+00 -15.947208 10.5472080 1.0000000
## Scion-Chevrolet       -5.350000e+00 -18.597208  7.8972080 0.9996251
## Subaru-Chevrolet      -3.300000e+00 -14.644231  8.0442312 0.9999998
## Subaru -Chevrolet     -1.100000e+00 -18.872995 16.6729945 1.0000000
## Toyoto-Chevrolet      -2.714286e-01  -8.943762  8.4009048 1.0000000
## Volkswagon-Chevrolet  -4.200000e+00 -15.544231  7.1442312 0.9999351
## Volvo-Chevrolet       -1.450000e+00 -14.697208 11.7972080 1.0000000
## Chrysler-Chevrolet     2.500000e+00 -16.848786 21.8487857 1.0000000
## Dodge-Chevrolet        4.000000e+00 -16.522486 24.5224864 1.0000000
## Dodge -Chevrolet       3.566667e+00 -15.782119 22.9154524 1.0000000
## Fiat-Chevrolet        -2.500000e+00 -26.197326 21.1973260 1.0000000
## Ford-Chevrolet         3.100000e+00 -14.813495 21.0134947 1.0000000
## Ford -Chevrolet       -3.200000e+00 -26.897326 20.4973260 1.0000000
## GMC -Chevrolet         1.390000e+01  -6.622486 34.4224864 0.7056631
## Honda -Chevrolet       3.825000e+00 -14.909381 22.5593812 1.0000000
## Hyundai-Chevrolet      1.214286e+00 -16.699209 19.1277804 1.0000000
## Infiniti-Chevrolet     6.300000e+00 -14.222486 26.8224864 0.9999991
## Jaguar-Chevrolet       4.650000e+00 -15.872486 25.1724864 1.0000000
## Jeep-Chevrolet         3.500000e+00 -17.022486 24.0224864 1.0000000
## Kia-Chevrolet         -4.400000e-01 -18.795870 17.9158698 1.0000000
## Land Rover-Chevrolet   2.500000e+00 -21.197326 26.1973260 1.0000000
## Lexus-Chevrolet        4.200000e+00 -16.322486 24.7224864 1.0000000
## Lincoln-Chevrolet      6.150000e+00 -14.372486 26.6724864 0.9999995
## Maserati-Chevrolet     5.400000e+00 -18.297326 29.0973260 1.0000000
## Mazda-Chevrolet       -2.133333e+00 -21.482119 17.2154524 1.0000000
## Mazda -Chevrolet      -2.900000e+00 -26.597326 20.7973260 1.0000000
## Mercedes-Chevrolet     2.350000e+00 -18.172486 22.8724864 1.0000000
## Mitsubishi-Chevrolet  -6.400000e+00 -30.097326 17.2973260 1.0000000
## Nissan-Chevrolet       4.333333e-01 -17.665798 18.5324651 1.0000000
## Porche-Chevrolet       1.300000e+00 -19.222486 21.8224864 1.0000000
## Scion-Chevrolet       -1.350000e+00 -21.872486 19.1724864 1.0000000
## Subaru-Chevrolet       7.000000e-01 -18.648786 20.0487857 1.0000000
## Subaru -Chevrolet      2.900000e+00 -20.797326 26.5973260 1.0000000
## Toyoto-Chevrolet       3.728571e+00 -14.184923 21.6420661 1.0000000
## Volkswagon-Chevrolet  -2.000000e-01 -19.548786 19.1487857 1.0000000
## Volvo-Chevrolet        2.550000e+00 -17.972486 23.0724864 1.0000000
## Dodge-Chrysler         1.500000e+00 -13.796558 16.7965582 1.0000000
## Dodge -Chrysler        1.066667e+00 -12.614991 14.7483242 1.0000000
## Fiat-Chrysler         -5.000000e+00 -24.348786 14.3487857 1.0000000
## Ford-Chrysler          6.000000e-01 -10.963111 12.1631111 1.0000000
## Ford -Chrysler        -5.700000e+00 -25.048786 13.6487857 0.9999997
## GMC -Chrysler          1.140000e+01  -3.896558 26.6965582 0.5023914
## Honda -Chrysler        1.325000e+00 -11.473019 14.1230188 1.0000000
## Hyundai-Chrysler      -1.285714e+00 -12.848825 10.2773968 1.0000000
## Infiniti-Chrysler      3.800000e+00 -11.496558 19.0965582 1.0000000
## Jaguar-Chrysler        2.150000e+00 -13.146558 17.4465582 1.0000000
## Jeep-Chrysler          1.000000e+00 -14.296558 16.2965582 1.0000000
## Kia-Chrysler          -2.940000e+00 -15.177247  9.2972466 1.0000000
## Land Rover-Chrysler    3.552714e-15 -19.348786 19.3487857 1.0000000
## Lexus-Chrysler         1.700000e+00 -13.596558 16.9965582 1.0000000
## Lincoln-Chrysler       3.650000e+00 -11.646558 18.9465582 1.0000000
## Maserati-Chrysler      2.900000e+00 -16.448786 22.2487857 1.0000000
## Mazda-Chrysler        -4.633333e+00 -18.314991  9.0483242 0.9999909
## Mazda -Chrysler       -5.400000e+00 -24.748786 13.9487857 0.9999999
## Mercedes-Chrysler     -1.500000e-01 -15.446558 15.1465582 1.0000000
## Mitsubishi-Chrysler   -8.900000e+00 -28.248786 10.4487857 0.9962594
## Nissan-Chrysler       -2.066667e+00 -13.915330  9.7819964 1.0000000
## Porche-Chrysler       -1.200000e+00 -16.496558 14.0965582 1.0000000
## Scion-Chrysler        -3.850000e+00 -19.146558 11.4465582 1.0000000
## Subaru-Chrysler       -1.800000e+00 -15.481658 11.8816576 1.0000000
## Subaru -Chrysler       4.000000e-01 -18.948786 19.7487857 1.0000000
## Toyoto-Chrysler        1.228571e+00 -10.334540 12.7916825 1.0000000
## Volkswagon-Chrysler   -2.700000e+00 -16.381658 10.9816576 1.0000000
## Volvo-Chrysler         5.000000e-02 -15.246558 15.3465582 1.0000000
## Dodge -Dodge          -4.333333e-01 -15.729892 14.8632249 1.0000000
## Fiat-Dodge            -6.500000e+00 -27.022486 14.0224864 0.9999981
## Ford-Dodge            -9.000000e-01 -14.335121 12.5351210 1.0000000
## Ford -Dodge           -7.200000e+00 -27.722486 13.3224864 0.9999798
## GMC -Dodge             9.900000e+00  -6.856540 26.6565399 0.9034635
## Honda -Dodge          -1.750000e-01 -14.686589 14.3365893 1.0000000
## Hyundai-Dodge         -2.785714e+00 -16.220835 10.6494067 1.0000000
## Infiniti-Dodge         2.300000e+00 -14.456540 19.0565399 1.0000000
## Jaguar-Dodge           6.500000e-01 -16.106540 17.4065399 1.0000000
## Jeep-Dodge            -5.000000e-01 -17.256540 16.2565399 1.0000000
## Kia-Dodge             -4.440000e+00 -18.459527  9.5795272 0.9999981
## Land Rover-Dodge      -1.500000e+00 -22.022486 19.0224864 1.0000000
## Lexus-Dodge            2.000000e-01 -16.556540 16.9565399 1.0000000
## Lincoln-Dodge          2.150000e+00 -14.606540 18.9065399 1.0000000
## Maserati-Dodge         1.400000e+00 -19.122486 21.9224864 1.0000000
## Mazda-Dodge           -6.133333e+00 -21.429892  9.1632249 0.9996737
## Mazda -Dodge          -6.900000e+00 -27.422486 13.6224864 0.9999923
## Mercedes-Dodge        -1.650000e+00 -18.406540 15.1065399 1.0000000
## Mitsubishi-Dodge      -1.040000e+01 -30.922486 10.1224864 0.9841298
## Nissan-Dodge          -3.566667e+00 -17.248324 10.1149909 1.0000000
## Porche-Dodge          -2.700000e+00 -19.456540 14.0565399 1.0000000
## Scion-Dodge           -5.350000e+00 -22.106540 11.4065399 0.9999977
## Subaru-Dodge          -3.300000e+00 -18.596558 11.9965582 1.0000000
## Subaru -Dodge         -1.100000e+00 -21.622486 19.4224864 1.0000000
## Toyoto-Dodge          -2.714286e-01 -13.706550 13.1636925 1.0000000
## Volkswagon-Dodge      -4.200000e+00 -19.496558 11.0965582 1.0000000
## Volvo-Dodge           -1.450000e+00 -18.206540 15.3065399 1.0000000
## Fiat-Dodge            -6.066667e+00 -25.415452 13.2821190 0.9999985
## Ford-Dodge            -4.666667e-01 -12.029778 11.0964444 1.0000000
## Ford -Dodge           -6.766667e+00 -26.115452 12.5821190 0.9999812
## GMC -Dodge             1.033333e+01  -4.963225 25.6298915 0.7106875
## Honda -Dodge           2.583333e-01 -12.539685 13.0563521 1.0000000
## Hyundai-Dodge         -2.352381e+00 -13.915492  9.2107302 1.0000000
## Infiniti-Dodge         2.733333e+00 -12.563225 18.0298915 1.0000000
## Jaguar-Dodge           1.083333e+00 -14.213225 16.3798915 1.0000000
## Jeep-Dodge            -6.666667e-02 -15.363225 15.2298915 1.0000000
## Kia-Dodge             -4.006667e+00 -16.243913  8.2305799 0.9999959
## Land Rover-Dodge      -1.066667e+00 -20.415452 18.2821190 1.0000000
## Lexus-Dodge            6.333333e-01 -14.663225 15.9298915 1.0000000
## Lincoln-Dodge          2.583333e+00 -12.713225 17.8798915 1.0000000
## Maserati-Dodge         1.833333e+00 -17.515452 21.1821190 1.0000000
## Mazda-Dodge           -5.700000e+00 -19.381658  7.9816576 0.9993264
## Mazda -Dodge          -6.466667e+00 -25.815452 12.8821190 0.9999933
## Mercedes-Dodge        -1.216667e+00 -16.513225 14.0798915 1.0000000
## Mitsubishi-Dodge      -9.966667e+00 -29.315452  9.3821190 0.9802147
## Nissan-Dodge          -3.133333e+00 -14.981996  8.7153297 1.0000000
## Porche-Dodge          -2.266667e+00 -17.563225 13.0298915 1.0000000
## Scion-Dodge           -4.916667e+00 -20.213225 10.3798915 0.9999973
## Subaru-Dodge          -2.866667e+00 -16.548324 10.8149909 1.0000000
## Subaru -Dodge         -6.666667e-01 -20.015452 18.6821190 1.0000000
## Toyoto-Dodge           1.619048e-01 -11.401206 11.7250159 1.0000000
## Volkswagon-Dodge      -3.766667e+00 -17.448324  9.9149909 0.9999999
## Volvo-Dodge           -1.016667e+00 -16.313225 14.2798915 1.0000000
## Ford-Fiat              5.600000e+00 -12.313495 23.5134947 0.9999986
## Ford -Fiat            -7.000000e-01 -24.397326 22.9973260 1.0000000
## GMC -Fiat              1.640000e+01  -4.122486 36.9224864 0.3501415
## Honda -Fiat            6.325000e+00 -12.409381 25.0593812 0.9999915
## Hyundai-Fiat           3.714286e+00 -14.199209 21.6277804 1.0000000
## Infiniti-Fiat          8.800000e+00 -11.722486 29.3224864 0.9988634
## Jaguar-Fiat            7.150000e+00 -13.372486 27.6724864 0.9999827
## Jeep-Fiat              6.000000e+00 -14.522486 26.5224864 0.9999997
## Kia-Fiat               2.060000e+00 -16.295870 20.4158698 1.0000000
## Land Rover-Fiat        5.000000e+00 -18.697326 28.6973260 1.0000000
## Lexus-Fiat             6.700000e+00 -13.822486 27.2224864 0.9999961
## Lincoln-Fiat           8.650000e+00 -11.872486 29.1724864 0.9991661
## Maserati-Fiat          7.900000e+00 -15.797326 31.5973260 0.9999937
## Mazda-Fiat             3.666667e-01 -18.982119 19.7154524 1.0000000
## Mazda -Fiat           -4.000000e-01 -24.097326 23.2973260 1.0000000
## Mercedes-Fiat          4.850000e+00 -15.672486 25.3724864 1.0000000
## Mitsubishi-Fiat       -3.900000e+00 -27.597326 19.7973260 1.0000000
## Nissan-Fiat            2.933333e+00 -15.165798 21.0324651 1.0000000
## Porche-Fiat            3.800000e+00 -16.722486 24.3224864 1.0000000
## Scion-Fiat             1.150000e+00 -19.372486 21.6724864 1.0000000
## Subaru-Fiat            3.200000e+00 -16.148786 22.5487857 1.0000000
## Subaru -Fiat           5.400000e+00 -18.297326 29.0973260 1.0000000
## Toyoto-Fiat            6.228571e+00 -11.684923 24.1420661 0.9999835
## Volkswagon-Fiat        2.300000e+00 -17.048786 21.6487857 1.0000000
## Volvo-Fiat             5.050000e+00 -15.472486 25.5724864 1.0000000
## Ford -Ford            -6.300000e+00 -24.213495 11.6134947 0.9999787
## GMC -Ford              1.080000e+01  -2.635121 24.2351210 0.3379393
## Honda -Ford            7.250000e-01  -9.777717 11.2277172 1.0000000
## Hyundai-Ford          -1.885714e+00 -10.842462  7.0710331 1.0000000
## Infiniti-Ford          3.200000e+00 -10.235121 16.6351210 1.0000000
## Jaguar-Ford            1.550000e+00 -11.885121 14.9851210 1.0000000
## Jeep-Ford              4.000000e-01 -13.035121 13.8351210 1.0000000
## Kia-Ford              -3.540000e+00 -13.351625  6.2716251 0.9999626
## Land Rover-Ford       -6.000000e-01 -18.513495 17.3134947 1.0000000
## Lexus-Ford             1.100000e+00 -12.335121 14.5351210 1.0000000
## Lincoln-Ford           3.050000e+00 -10.385121 16.4851210 1.0000000
## Maserati-Ford          2.300000e+00 -15.613495 20.2134947 1.0000000
## Mazda-Ford            -5.233333e+00 -16.796444  6.3297778 0.9971280
## Mazda -Ford           -6.000000e+00 -23.913495 11.9134947 0.9999929
## Mercedes-Ford         -7.500000e-01 -14.185121 12.6851210 1.0000000
## Mitsubishi-Ford       -9.500000e+00 -27.413495  8.4134947 0.9711718
## Nissan-Ford           -2.666667e+00 -11.989145  6.6558115 0.9999999
## Porche-Ford           -1.800000e+00 -15.235121 11.6351210 1.0000000
## Scion-Ford            -4.450000e+00 -17.885121  8.9851210 0.9999946
## Subaru-Ford           -2.400000e+00 -13.963111  9.1631111 1.0000000
## Subaru -Ford          -2.000000e-01 -18.113495 17.7134947 1.0000000
## Toyoto-Ford            6.285714e-01  -8.328176  9.5853188 1.0000000
## Volkswagon-Ford       -3.300000e+00 -14.863111  8.2631111 0.9999999
## Volvo-Ford            -5.500000e-01 -13.985121 12.8851210 1.0000000
## GMC -Ford              1.710000e+01  -3.422486 37.6224864 0.2678457
## Honda -Ford            7.025000e+00 -11.709381 25.7593812 0.9999152
## Hyundai-Ford           4.414286e+00 -13.499209 22.3277804 1.0000000
## Infiniti-Ford          9.500000e+00 -11.022486 30.0224864 0.9958583
## Jaguar-Ford            7.850000e+00 -12.672486 28.3724864 0.9998722
## Jeep-Ford              6.700000e+00 -13.822486 27.2224864 0.9999961
## Kia-Ford               2.760000e+00 -15.595870 21.1158698 1.0000000
## Land Rover-Ford        5.700000e+00 -17.997326 29.3973260 1.0000000
## Lexus-Ford             7.400000e+00 -13.122486 27.9224864 0.9999631
## Lincoln-Ford           9.350000e+00 -11.172486 29.8724864 0.9967975
## Maserati-Ford          8.600000e+00 -15.097326 32.2973260 0.9999576
## Mazda-Ford             1.066667e+00 -18.282119 20.4154524 1.0000000
## Mazda -Ford            3.000000e-01 -23.397326 23.9973260 1.0000000
## Mercedes-Ford          5.550000e+00 -14.972486 26.0724864 1.0000000
## Mitsubishi-Ford       -3.200000e+00 -26.897326 20.4973260 1.0000000
## Nissan-Ford            3.633333e+00 -14.465798 21.7324651 1.0000000
## Porche-Ford            4.500000e+00 -16.022486 25.0224864 1.0000000
## Scion-Ford             1.850000e+00 -18.672486 22.3724864 1.0000000
## Subaru-Ford            3.900000e+00 -15.448786 23.2487857 1.0000000
## Subaru -Ford           6.100000e+00 -17.597326 29.7973260 1.0000000
## Toyoto-Ford            6.928571e+00 -10.984923 24.8420661 0.9998399
## Volkswagon-Ford        3.000000e+00 -16.348786 22.3487857 1.0000000
## Volvo-Ford             5.750000e+00 -14.772486 26.2724864 0.9999999
## Honda -GMC            -1.007500e+01 -24.586589  4.4365893 0.6563486
## Hyundai-GMC           -1.268571e+01 -26.120835  0.7494067 0.0931320
## Infiniti-GMC          -7.600000e+00 -24.356540  9.1565399 0.9970253
## Jaguar-GMC            -9.250000e+00 -26.006540  7.5065399 0.9532662
## Jeep-GMC              -1.040000e+01 -27.156540  6.3565399 0.8479720
## Kia-GMC               -1.434000e+01 -28.359527 -0.3204728 0.0381737
## Land Rover-GMC        -1.140000e+01 -31.922486  9.1224864 0.9497917
## Lexus-GMC             -9.700000e+00 -26.456540  7.0565399 0.9214204
## Lincoln-GMC           -7.750000e+00 -24.506540  9.0065399 0.9959152
## Maserati-GMC          -8.500000e+00 -29.022486 12.0224864 0.9993958
## Mazda-GMC             -1.603333e+01 -31.329892 -0.7367751 0.0280525
## Mazda -GMC            -1.680000e+01 -37.322486  3.7224864 0.3015107
## Mercedes-GMC          -1.155000e+01 -28.306540  5.2065399 0.6710552
## Mitsubishi-GMC        -2.030000e+01 -40.822486  0.2224864 0.0566610
## Nissan-GMC            -1.346667e+01 -27.148324  0.2149909 0.0598993
## Porche-GMC            -1.260000e+01 -29.356540  4.1565399 0.4824644
## Scion-GMC             -1.525000e+01 -32.006540  1.5065399 0.1324815
## Subaru-GMC            -1.320000e+01 -28.496558  2.0965582 0.2072700
## Subaru -GMC           -1.100000e+01 -31.522486  9.5224864 0.9670996
## Toyoto-GMC            -1.017143e+01 -23.606550  3.2636925 0.4672973
## Volkswagon-GMC        -1.410000e+01 -29.396558  1.1965582 0.1177256
## Volvo-GMC             -1.135000e+01 -28.106540  5.4065399 0.7055447
## Hyundai-Honda         -2.610714e+00 -13.113432  7.8920029 1.0000000
## Infiniti-Honda         2.475000e+00 -12.036589 16.9865893 1.0000000
## Jaguar-Honda           8.250000e-01 -13.686589 15.3365893 1.0000000
## Jeep-Honda            -3.250000e-01 -14.836589 14.1865893 1.0000000
## Kia-Honda             -4.265000e+00 -15.505629  6.9756287 0.9998917
## Land Rover-Honda      -1.325000e+00 -20.059381 17.4093812 1.0000000
## Lexus-Honda            3.750000e-01 -14.136589 14.8865893 1.0000000
## Lincoln-Honda          2.325000e+00 -12.186589 16.8365893 1.0000000
## Maserati-Honda         1.575000e+00 -17.159381 20.3093812 1.0000000
## Mazda-Honda           -5.958333e+00 -18.756352  6.8396854 0.9954634
## Mazda -Honda          -6.725000e+00 -25.459381 12.0093812 0.9999665
## Mercedes-Honda        -1.475000e+00 -15.986589 13.0365893 1.0000000
## Mitsubishi-Honda      -1.022500e+01 -28.959381  8.5093812 0.9590750
## Nissan-Honda          -3.391667e+00 -14.207967  7.4246334 0.9999985
## Porche-Honda          -2.525000e+00 -17.036589 11.9865893 1.0000000
## Scion-Honda           -5.175000e+00 -19.686589  9.3365893 0.9999710
## Subaru-Honda          -3.125000e+00 -15.923019  9.6730188 1.0000000
## Subaru -Honda         -9.250000e-01 -19.659381 17.8093812 1.0000000
## Toyoto-Honda          -9.642857e-02 -10.599146 10.4062887 1.0000000
## Volkswagon-Honda      -4.025000e+00 -16.823019  8.7730188 0.9999984
## Volvo-Honda           -1.275000e+00 -15.786589 13.2365893 1.0000000
## Infiniti-Hyundai       5.085714e+00  -8.349407 18.5208353 0.9998968
## Jaguar-Hyundai         3.435714e+00  -9.999407 16.8708353 1.0000000
## Jeep-Hyundai           2.285714e+00 -11.149407 15.7208353 1.0000000
## Kia-Hyundai           -1.654286e+00 -11.465911  8.1573394 1.0000000
## Land Rover-Hyundai     1.285714e+00 -16.627780 19.1992090 1.0000000
## Lexus-Hyundai          2.985714e+00 -10.449407 16.4208353 1.0000000
## Lincoln-Hyundai        4.935714e+00  -8.499407 18.3708353 0.9999449
## Maserati-Hyundai       4.185714e+00 -13.727780 22.0992090 1.0000000
## Mazda-Hyundai         -3.347619e+00 -14.910730  8.2154921 0.9999998
## Mazda -Hyundai        -4.114286e+00 -22.027780 13.7992090 1.0000000
## Mercedes-Hyundai       1.135714e+00 -12.299407 14.5708353 1.0000000
## Mitsubishi-Hyundai    -7.614286e+00 -25.527780 10.2992090 0.9990285
## Nissan-Hyundai        -7.809524e-01 -10.103431  8.5415258 1.0000000
## Porche-Hyundai         8.571429e-02 -13.349407 13.5208353 1.0000000
## Scion-Hyundai         -2.564286e+00 -15.999407 10.8708353 1.0000000
## Subaru-Hyundai        -5.142857e-01 -12.077397 11.0488254 1.0000000
## Subaru -Hyundai        1.685714e+00 -16.227780 19.5992090 1.0000000
## Toyoto-Hyundai         2.514286e+00  -6.442462 11.4710331 0.9999999
## Volkswagon-Hyundai    -1.414286e+00 -12.977397 10.1488254 1.0000000
## Volvo-Hyundai          1.335714e+00 -12.099407 14.7708353 1.0000000
## Jaguar-Infiniti       -1.650000e+00 -18.406540 15.1065399 1.0000000
## Jeep-Infiniti         -2.800000e+00 -19.556540 13.9565399 1.0000000
## Kia-Infiniti          -6.740000e+00 -20.759527  7.2795272 0.9925552
## Land Rover-Infiniti   -3.800000e+00 -24.322486 16.7224864 1.0000000
## Lexus-Infiniti        -2.100000e+00 -18.856540 14.6565399 1.0000000
## Lincoln-Infiniti      -1.500000e-01 -16.906540 16.6065399 1.0000000
## Maserati-Infiniti     -9.000000e-01 -21.422486 19.6224864 1.0000000
## Mazda-Infiniti        -8.433333e+00 -23.729892  6.8632249 0.9539475
## Mazda -Infiniti       -9.200000e+00 -29.722486 11.3224864 0.9975496
## Mercedes-Infiniti     -3.950000e+00 -20.706540 12.8065399 1.0000000
## Mitsubishi-Infiniti   -1.270000e+01 -33.222486  7.8224864 0.8517831
## Nissan-Infiniti       -5.866667e+00 -19.548324  7.8149909 0.9988634
## Porche-Infiniti       -5.000000e+00 -21.756540 11.7565399 0.9999996
## Scion-Infiniti        -7.650000e+00 -24.406540  9.1065399 0.9966879
## Subaru-Infiniti       -5.600000e+00 -20.896558  9.6965582 0.9999489
## Subaru -Infiniti      -3.400000e+00 -23.922486 17.1224864 1.0000000
## Toyoto-Infiniti       -2.571429e+00 -16.006550 10.8636925 1.0000000
## Volkswagon-Infiniti   -6.500000e+00 -21.796558  8.7965582 0.9990337
## Volvo-Infiniti        -3.750000e+00 -20.506540 13.0065399 1.0000000
## Jeep-Jaguar           -1.150000e+00 -17.906540 15.6065399 1.0000000
## Kia-Jaguar            -5.090000e+00 -19.109527  8.9295272 0.9999572
## Land Rover-Jaguar     -2.150000e+00 -22.672486 18.3724864 1.0000000
## Lexus-Jaguar          -4.500000e-01 -17.206540 16.3065399 1.0000000
## Lincoln-Jaguar         1.500000e+00 -15.256540 18.2565399 1.0000000
## Maserati-Jaguar        7.500000e-01 -19.772486 21.2724864 1.0000000
## Mazda-Jaguar          -6.783333e+00 -22.079892  8.5132249 0.9979594
## Mazda -Jaguar         -7.550000e+00 -28.072486 12.9724864 0.9999433
## Mercedes-Jaguar       -2.300000e+00 -19.056540 14.4565399 1.0000000
## Mitsubishi-Jaguar     -1.105000e+01 -31.572486  9.4724864 0.9652233
## Nissan-Jaguar         -4.216667e+00 -17.898324  9.4649909 0.9999990
## Porche-Jaguar         -3.350000e+00 -20.106540 13.4065399 1.0000000
## Scion-Jaguar          -6.000000e+00 -22.756540 10.7565399 0.9999683
## Subaru-Jaguar         -3.950000e+00 -19.246558 11.3465582 1.0000000
## Subaru -Jaguar        -1.750000e+00 -22.272486 18.7724864 1.0000000
## Toyoto-Jaguar         -9.214286e-01 -14.356550 12.5136925 1.0000000
## Volkswagon-Jaguar     -4.850000e+00 -20.146558 10.4465582 0.9999981
## Volvo-Jaguar          -2.100000e+00 -18.856540 14.6565399 1.0000000
## Kia-Jeep              -3.940000e+00 -17.959527 10.0795272 0.9999999
## Land Rover-Jeep       -1.000000e+00 -21.522486 19.5224864 1.0000000
## Lexus-Jeep             7.000000e-01 -16.056540 17.4565399 1.0000000
## Lincoln-Jeep           2.650000e+00 -14.106540 19.4065399 1.0000000
## Maserati-Jeep          1.900000e+00 -18.622486 22.4224864 1.0000000
## Mazda-Jeep            -5.633333e+00 -20.929892  9.6632249 0.9999420
## Mazda -Jeep           -6.400000e+00 -26.922486 14.1224864 0.9999987
## Mercedes-Jeep         -1.150000e+00 -17.906540 15.6065399 1.0000000
## Mitsubishi-Jeep       -9.900000e+00 -30.422486 10.6224864 0.9921654
## Nissan-Jeep           -3.066667e+00 -16.748324 10.6149909 1.0000000
## Porche-Jeep           -2.200000e+00 -18.956540 14.5565399 1.0000000
## Scion-Jeep            -4.850000e+00 -21.606540 11.9065399 0.9999998
## Subaru-Jeep           -2.800000e+00 -18.096558 12.4965582 1.0000000
## Subaru -Jeep          -6.000000e-01 -21.122486 19.9224864 1.0000000
## Toyoto-Jeep            2.285714e-01 -13.206550 13.6636925 1.0000000
## Volkswagon-Jeep       -3.700000e+00 -18.996558 11.5965582 1.0000000
## Volvo-Jeep            -9.500000e-01 -17.706540 15.8065399 1.0000000
## Land Rover-Kia         2.940000e+00 -15.415870 21.2958698 1.0000000
## Lexus-Kia              4.640000e+00  -9.379527 18.6595272 0.9999947
## Lincoln-Kia            6.590000e+00  -7.429527 20.6095272 0.9947250
## Maserati-Kia           5.840000e+00 -12.515870 24.1958698 0.9999979
## Mazda-Kia             -1.693333e+00 -13.930580 10.5439132 1.0000000
## Mazda -Kia            -2.460000e+00 -20.815870 15.8958698 1.0000000
## Mercedes-Kia           2.790000e+00 -11.229527 16.8095272 1.0000000
## Mitsubishi-Kia        -5.960000e+00 -24.315870 12.3958698 0.9999966
## Nissan-Kia             8.733333e-01  -9.273255 11.0199222 1.0000000
## Porche-Kia             1.740000e+00 -12.279527 15.7595272 1.0000000
## Scion-Kia             -9.100000e-01 -14.929527 13.1095272 1.0000000
## Subaru-Kia             1.140000e+00 -11.097247 13.3772466 1.0000000
## Subaru -Kia            3.340000e+00 -15.015870 21.6958698 1.0000000
## Toyoto-Kia             4.168571e+00  -5.643054 13.9801966 0.9990366
## Volkswagon-Kia         2.400000e-01 -11.997247 12.4772466 1.0000000
## Volvo-Kia              2.990000e+00 -11.029527 17.0095272 1.0000000
## Lexus-Land Rover       1.700000e+00 -18.822486 22.2224864 1.0000000
## Lincoln-Land Rover     3.650000e+00 -16.872486 24.1724864 1.0000000
## Maserati-Land Rover    2.900000e+00 -20.797326 26.5973260 1.0000000
## Mazda-Land Rover      -4.633333e+00 -23.982119 14.7154524 1.0000000
## Mazda -Land Rover     -5.400000e+00 -29.097326 18.2973260 1.0000000
## Mercedes-Land Rover   -1.500000e-01 -20.672486 20.3724864 1.0000000
## Mitsubishi-Land Rover -8.900000e+00 -32.597326 14.7973260 0.9999124
## Nissan-Land Rover     -2.066667e+00 -20.165798 16.0324651 1.0000000
## Porche-Land Rover     -1.200000e+00 -21.722486 19.3224864 1.0000000
## Scion-Land Rover      -3.850000e+00 -24.372486 16.6724864 1.0000000
## Subaru-Land Rover     -1.800000e+00 -21.148786 17.5487857 1.0000000
## Subaru -Land Rover     4.000000e-01 -23.297326 24.0973260 1.0000000
## Toyoto-Land Rover      1.228571e+00 -16.684923 19.1420661 1.0000000
## Volkswagon-Land Rover -2.700000e+00 -22.048786 16.6487857 1.0000000
## Volvo-Land Rover       5.000000e-02 -20.472486 20.5724864 1.0000000
## Lincoln-Lexus          1.950000e+00 -14.806540 18.7065399 1.0000000
## Maserati-Lexus         1.200000e+00 -19.322486 21.7224864 1.0000000
## Mazda-Lexus           -6.333333e+00 -21.629892  8.9632249 0.9993997
## Mazda -Lexus          -7.100000e+00 -27.622486 13.4224864 0.9999852
## Mercedes-Lexus        -1.850000e+00 -18.606540 14.9065399 1.0000000
## Mitsubishi-Lexus      -1.060000e+01 -31.122486  9.9224864 0.9794891
## Nissan-Lexus          -3.766667e+00 -17.448324  9.9149909 0.9999999
## Porche-Lexus          -2.900000e+00 -19.656540 13.8565399 1.0000000
## Scion-Lexus           -5.550000e+00 -22.306540 11.2065399 0.9999946
## Subaru-Lexus          -3.500000e+00 -18.796558 11.7965582 1.0000000
## Subaru -Lexus         -1.300000e+00 -21.822486 19.2224864 1.0000000
## Toyoto-Lexus          -4.714286e-01 -13.906550 12.9636925 1.0000000
## Volkswagon-Lexus      -4.400000e+00 -19.696558 10.8965582 0.9999998
## Volvo-Lexus           -1.650000e+00 -18.406540 15.1065399 1.0000000
## Maserati-Lincoln      -7.500000e-01 -21.272486 19.7724864 1.0000000
## Mazda-Lincoln         -8.283333e+00 -23.579892  7.0132249 0.9627364
## Mazda -Lincoln        -9.050000e+00 -29.572486 11.4724864 0.9981454
## Mercedes-Lincoln      -3.800000e+00 -20.556540 12.9565399 1.0000000
## Mitsubishi-Lincoln    -1.255000e+01 -33.072486  7.9724864 0.8665414
## Nissan-Lincoln        -5.716667e+00 -19.398324  7.9649909 0.9992891
## Porche-Lincoln        -4.850000e+00 -21.606540 11.9065399 0.9999998
## Scion-Lincoln         -7.500000e+00 -24.256540  9.2565399 0.9976132
## Subaru-Lincoln        -5.450000e+00 -20.746558  9.8465582 0.9999716
## Subaru -Lincoln       -3.250000e+00 -23.772486 17.2724864 1.0000000
## Toyoto-Lincoln        -2.421429e+00 -15.856550 11.0136925 1.0000000
## Volkswagon-Lincoln    -6.350000e+00 -21.646558  8.9465582 0.9993696
## Volvo-Lincoln         -3.600000e+00 -20.356540 13.1565399 1.0000000
## Mazda-Maserati        -7.533333e+00 -26.882119 11.8154524 0.9998172
## Mazda -Maserati       -8.300000e+00 -31.997326 15.3973260 0.9999805
## Mercedes-Maserati     -3.050000e+00 -23.572486 17.4724864 1.0000000
## Mitsubishi-Maserati   -1.180000e+01 -35.497326 11.8973260 0.9875710
## Nissan-Maserati       -4.966667e+00 -23.065798 13.1324651 1.0000000
## Porche-Maserati       -4.100000e+00 -24.622486 16.4224864 1.0000000
## Scion-Maserati        -6.750000e+00 -27.272486 13.7724864 0.9999954
## Subaru-Maserati       -4.700000e+00 -24.048786 14.6487857 1.0000000
## Subaru -Maserati      -2.500000e+00 -26.197326 21.1973260 1.0000000
## Toyoto-Maserati       -1.671429e+00 -19.584923 16.2420661 1.0000000
## Volkswagon-Maserati   -5.600000e+00 -24.948786 13.7487857 0.9999998
## Volvo-Maserati        -2.850000e+00 -23.372486 17.6724864 1.0000000
## Mazda -Mazda          -7.666667e-01 -20.115452 18.5821190 1.0000000
## Mercedes-Mazda         4.483333e+00 -10.813225 19.7798915 0.9999997
## Mitsubishi-Mazda      -4.266667e+00 -23.615452 15.0821190 1.0000000
## Nissan-Mazda           2.566667e+00  -9.281996 14.4153297 1.0000000
## Porche-Mazda           3.433333e+00 -11.863225 18.7298915 1.0000000
## Scion-Mazda            7.833333e-01 -14.513225 16.0798915 1.0000000
## Subaru-Mazda           2.833333e+00 -10.848324 16.5149909 1.0000000
## Subaru -Mazda          5.033333e+00 -14.315452 24.3821190 1.0000000
## Toyoto-Mazda           5.861905e+00  -5.701206 17.4250159 0.9840492
## Volkswagon-Mazda       1.933333e+00 -11.748324 15.6149909 1.0000000
## Volvo-Mazda            4.683333e+00 -10.613225 19.9798915 0.9999992
## Mercedes-Mazda         5.250000e+00 -15.272486 25.7724864 1.0000000
## Mitsubishi-Mazda      -3.500000e+00 -27.197326 20.1973260 1.0000000
## Nissan-Mazda           3.333333e+00 -14.765798 21.4324651 1.0000000
## Porche-Mazda           4.200000e+00 -16.322486 24.7224864 1.0000000
## Scion-Mazda            1.550000e+00 -18.972486 22.0724864 1.0000000
## Subaru-Mazda           3.600000e+00 -15.748786 22.9487857 1.0000000
## Subaru -Mazda          5.800000e+00 -17.897326 29.4973260 1.0000000
## Toyoto-Mazda           6.628571e+00 -11.284923 24.5420661 0.9999358
## Volkswagon-Mazda       2.700000e+00 -16.648786 22.0487857 1.0000000
## Volvo-Mazda            5.450000e+00 -15.072486 25.9724864 1.0000000
## Mitsubishi-Mercedes   -8.750000e+00 -29.272486 11.7724864 0.9989735
## Nissan-Mercedes       -1.916667e+00 -15.598324 11.7649909 1.0000000
## Porche-Mercedes       -1.050000e+00 -17.806540 15.7065399 1.0000000
## Scion-Mercedes        -3.700000e+00 -20.456540 13.0565399 1.0000000
## Subaru-Mercedes       -1.650000e+00 -16.946558 13.6465582 1.0000000
## Subaru -Mercedes       5.500000e-01 -19.972486 21.0724864 1.0000000
## Toyoto-Mercedes        1.378571e+00 -12.056550 14.8136925 1.0000000
## Volkswagon-Mercedes   -2.550000e+00 -17.846558 12.7465582 1.0000000
## Volvo-Mercedes         2.000000e-01 -16.556540 16.9565399 1.0000000
## Nissan-Mitsubishi      6.833333e+00 -11.265798 24.9324651 0.9999023
## Porche-Mitsubishi      7.700000e+00 -12.822486 28.2224864 0.9999142
## Scion-Mitsubishi       5.050000e+00 -15.472486 25.5724864 1.0000000
## Subaru-Mitsubishi      7.100000e+00 -12.248786 26.4487857 0.9999463
## Subaru -Mitsubishi     9.300000e+00 -14.397326 32.9973260 0.9997858
## Toyoto-Mitsubishi      1.012857e+01  -7.784923 28.0420661 0.9388201
## Volkswagon-Mitsubishi  6.200000e+00 -13.148786 25.5487857 0.9999975
## Volvo-Mitsubishi       8.950000e+00 -11.572486 29.4724864 0.9984693
## Porche-Nissan          8.666667e-01 -12.814991 14.5483242 1.0000000
## Scion-Nissan          -1.783333e+00 -15.464991 11.8983242 1.0000000
## Subaru-Nissan          2.666667e-01 -11.581996 12.1153297 1.0000000
## Subaru -Nissan         2.466667e+00 -15.632465 20.5657984 1.0000000
## Toyoto-Nissan          3.295238e+00  -6.027240 12.6177163 0.9999761
## Volkswagon-Nissan     -6.333333e-01 -12.481996 11.2153297 1.0000000
## Volvo-Nissan           2.116667e+00 -11.564991 15.7983242 1.0000000
## Scion-Porche          -2.650000e+00 -19.406540 14.1065399 1.0000000
## Subaru-Porche         -6.000000e-01 -15.896558 14.6965582 1.0000000
## Subaru -Porche         1.600000e+00 -18.922486 22.1224864 1.0000000
## Toyoto-Porche          2.428571e+00 -11.006550 15.8636925 1.0000000
## Volkswagon-Porche     -1.500000e+00 -16.796558 13.7965582 1.0000000
## Volvo-Porche           1.250000e+00 -15.506540 18.0065399 1.0000000
## Subaru-Scion           2.050000e+00 -13.246558 17.3465582 1.0000000
## Subaru -Scion          4.250000e+00 -16.272486 24.7724864 1.0000000
## Toyoto-Scion           5.078571e+00  -8.356550 18.5136925 0.9998998
## Volkswagon-Scion       1.150000e+00 -14.146558 16.4465582 1.0000000
## Volvo-Scion            3.900000e+00 -12.856540 20.6565399 1.0000000
## Subaru -Subaru         2.200000e+00 -17.148786 21.5487857 1.0000000
## Toyoto-Subaru          3.028571e+00  -8.534540 14.5916825 1.0000000
## Volkswagon-Subaru     -9.000000e-01 -14.581658 12.7816576 1.0000000
## Volvo-Subaru           1.850000e+00 -13.446558 17.1465582 1.0000000
## Toyoto-Subaru          8.285714e-01 -17.084923 18.7420661 1.0000000
## Volkswagon-Subaru     -3.100000e+00 -22.448786 16.2487857 1.0000000
## Volvo-Subaru          -3.500000e-01 -20.872486 20.1724864 1.0000000
## Volkswagon-Toyoto     -3.928571e+00 -15.491683  7.6345397 0.9999902
## Volvo-Toyoto          -1.178571e+00 -14.613692 12.2565496 1.0000000
## Volvo-Volkswagon       2.750000e+00 -12.546558 18.0465582 1.0000000
eta_sq(anova.all)
## Warning: 'eta_sq' is deprecated.
## Use 'effectsize::eta_squared()' instead.
## See help("Deprecated")
## For one-way between subjects designs, partial eta squared is equivalent to eta squared.
## Returning eta squared.
pwr.anova.test(k=2, sig.level=0.05, f=1.321, n=10, power=NULL)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 2
##               n = 10
##               f = 1.321
##       sig.level = 0.05
##           power = 0.9998474
## 
## NOTE: n is number in each group

The explantory variable for this analysis is “Make” of the vehicels and the response variable is the FuelCap for each respective car Make. Before conduction the Analysis of Variance test the conditions where met. There was no significant difference in the mean for the Make. With the Test, we check the similarity of variance. The null is no difference in variances in all the groups involved. For the Hypothesis, Ho: muG_Make = muK_Make = muQ_Make, all the same Ha: mu≠mu, no difference can be seen so we do not reject the null. The p value from our summary calculations is 1.312. Power test is relevant because it allows you to determine the sample size required to detect an effect of a given size with a given degree of confidence level. There were not as many outliers in this data analysis all the outputs where all around the same level so there was not much change to the mean.

Analysis 3:[Name/Description]

Analyst:[Name of Team Member]

[Put text of analysis here and add as many code chunks and text sections as you need.]

Analysis 4: MLR (Two quantitative variables, 1 response variable)

Analyst: Alec Mattu

Preface, Setup

Preface: We need to reference the appropriate packages.

library(tidyverse)
library(car)

Let’s begin the analysis by importing the Cars 2015 (Model year subset) dataset and cleaning rows with missing values.

# Load Data
cars <- read.csv("./Cars2015.csv")

As a quick recap of the data, let’s take a look at the various features in the dataset.

# View Dimensions of the data
dim(cars)
## [1] 110  20
# View column names
names(cars)
##  [1] "Make"      "Model"     "Type"      "LowPrice"  "HighPrice" "Drive"    
##  [7] "CityMPG"   "HwyMPG"    "FuelCap"   "Length"    "Width"     "Wheelbase"
## [13] "Height"    "UTurn"     "Weight"    "Acc030"    "Acc060"    "QtrMile"  
## [19] "PageNum"   "Size"
str(cars)
## 'data.frame':    110 obs. of  20 variables:
##  $ Make     : chr  "Chevrolet" "Hyundai" "Kia" "Mitsubishi" ...
##  $ Model    : chr  "Spark" "Accent" "Rio" "Mirage" ...
##  $ Type     : chr  "Hatchback" "Hatchback" "Sedan" "Hatchback" ...
##  $ LowPrice : num  12.3 14.7 14 13 14.2 ...
##  $ HighPrice: num  25.6 17.5 18.3 15.4 18 ...
##  $ Drive    : chr  "FWD" "FWD" "FWD" "FWD" ...
##  $ CityMPG  : int  30 28 28 37 31 23 24 24 28 30 ...
##  $ HwyMPG   : int  39 37 36 44 40 35 36 33 38 35 ...
##  $ FuelCap  : num  9 11.4 11.3 9.2 10.9 14.2 15.6 13.1 12.4 11.1 ...
##  $ Length   : int  145 172 172 149 164 184 181 167 179 154 ...
##  $ Width    : int  63 67 68 66 67 72 71 70 72 67 ...
##  $ Wheelbase: int  94 101 101 97 102 106 106 103 104 99 ...
##  $ Height   : int  61 57 57 59 61 58 58 66 58 59 ...
##  $ UTurn    : int  34 37 37 32 37 38 38 37 39 34 ...
##  $ Weight   : int  2345 2550 2575 2085 2470 3260 3140 3330 2990 2385 ...
##  $ Acc030   : num  4.4 3.7 3.5 4.4 4 3.4 3.7 3.9 3.4 3.9 ...
##  $ Acc060   : num  12.8 10.3 9.5 12.1 10.9 9.3 9.8 9.5 9.2 10.8 ...
##  $ QtrMile  : num  19.4 17.8 17.3 19 18.2 17.2 17.6 17.4 17.1 18.3 ...
##  $ PageNum  : int  123 148 163 188 196 128 119 131 136 216 ...
##  $ Size     : chr  "Small" "Small" "Small" "Small" ...
# View first few rows of data
head(cars)
# View last few rows of data
tail(cars)
Hypothesis/Summary

In this modern world that we live in, where fuel efficiency technology and manufacturing technology is constantly improving, what can we derive from analyzing the EPA rated City mpg on vehicles? I suspect that we can draw conclusions on what type of fuel tank capacity is required or how heavy a particular vehicle is based just off of the EPA rated fuel efficiency.

\(H_0\): There is a strong correlation between the city miles-per-gallon EPA rating on a vehicle and the fuel tank capacity (gal) as well as the vehicle dry-weight (lbs). I propose that we will see a negatively correlated linear relationship between the City MPG and the Fuel Capacity / Weight of a vehicle.

\(H_A\): There is a insignificant or non-existent correlation between a vehicle’s EPA rated City MPG and the fuel tank capacity / dry-weight.

Response Variable

The chosen response variable for this analysis will be CityMPG; To begin our actual analysis, let’s visualize the data behind this variable.

ggplot(data = cars) +
  xlab("EPA Rated City Mpg") +
  geom_boxplot(mapping = aes(x = CityMPG))

ggplot(data = cars) +
  xlab("EPA Rated City Mpg") +
  geom_histogram(mapping = aes(x = CityMPG), binwidth = 0.75)

From both of the above graphics, we can see that a majority of the observations in the dataset revolve around the ~20mpg area. There are a few concerning outliers above 30mpg, so let’s dig deeper into those outliers before continuing.

cars_tibble <- as_tibble(cars[1:8])
cars_tibble %>% filter(CityMPG > 30)

From what we can see above, although these outliers originally appeared to be incorrect data, we can make the assumption that they are in fact correct. Not only can we fact check this (2015 Mirage MPG | 2015 Versa Note MPG), we can also base our assumption off of the fact that they are both relatively small hatchbacks and compare that to similar vehicles in that category.

Explanatory Variable 1

In order to find predictors of our response variable (CityMPG), let’s use a correlation matrix. Although this was generalized previously, we need to find the finite list of columns which are numerical in order to predict the response variable. We’re going to approach this model building from the “bottom up”, where we find highly correlated variables and work from there.

# Pull the complete columns from the dataset
numerical_columns <- cars[complete.cases(cars), ]
  
# Pull the complete numerical columns from the dataset
# Correlation matrix
complete_numerical_columns <- numerical_columns[, sapply(numerical_columns, is.numeric)]
print(round(cor(complete_numerical_columns), 2))
##           LowPrice HighPrice CityMPG HwyMPG FuelCap Length Width Wheelbase
## LowPrice      1.00      0.91   -0.65  -0.59    0.57   0.47  0.48      0.46
## HighPrice     0.91      1.00   -0.56  -0.49    0.47   0.39  0.37      0.39
## CityMPG      -0.65     -0.56    1.00   0.93   -0.77  -0.72 -0.78     -0.69
## HwyMPG       -0.59     -0.49    0.93   1.00   -0.75  -0.64 -0.75     -0.64
## FuelCap       0.57      0.47   -0.77  -0.75    1.00   0.82  0.85      0.79
## Length        0.47      0.39   -0.72  -0.64    0.82   1.00  0.81      0.92
## Width         0.48      0.37   -0.78  -0.75    0.85   0.81  1.00      0.76
## Wheelbase     0.46      0.39   -0.69  -0.64    0.79   0.92  0.76      1.00
## Height        0.02     -0.10   -0.39  -0.54    0.58   0.46  0.62      0.49
## UTurn         0.40      0.31   -0.73  -0.68    0.76   0.84  0.77      0.81
## Weight        0.55      0.43   -0.83  -0.84    0.91   0.82  0.91      0.81
## Acc030       -0.76     -0.74    0.64   0.51   -0.47  -0.38 -0.41     -0.31
## Acc060       -0.74     -0.72    0.68   0.52   -0.49  -0.47 -0.46     -0.38
## QtrMile      -0.76     -0.76    0.65   0.49   -0.45  -0.42 -0.41     -0.35
## PageNum      -0.23     -0.20    0.28   0.15   -0.15  -0.23 -0.20     -0.24
##           Height UTurn Weight Acc030 Acc060 QtrMile PageNum
## LowPrice    0.02  0.40   0.55  -0.76  -0.74   -0.76   -0.23
## HighPrice  -0.10  0.31   0.43  -0.74  -0.72   -0.76   -0.20
## CityMPG    -0.39 -0.73  -0.83   0.64   0.68    0.65    0.28
## HwyMPG     -0.54 -0.68  -0.84   0.51   0.52    0.49    0.15
## FuelCap     0.58  0.76   0.91  -0.47  -0.49   -0.45   -0.15
## Length      0.46  0.84   0.82  -0.38  -0.47   -0.42   -0.23
## Width       0.62  0.77   0.91  -0.41  -0.46   -0.41   -0.20
## Wheelbase   0.49  0.81   0.81  -0.31  -0.38   -0.35   -0.24
## Height      1.00  0.55   0.71   0.21   0.21    0.25    0.06
## UTurn       0.55  1.00   0.80  -0.36  -0.41   -0.37   -0.22
## Weight      0.71  0.80   1.00  -0.41  -0.43   -0.39   -0.20
## Acc030      0.21 -0.36  -0.41   1.00   0.95    0.95    0.25
## Acc060      0.21 -0.41  -0.43   0.95   1.00    0.99    0.26
## QtrMile     0.25 -0.37  -0.39   0.95   0.99    1.00    0.26
## PageNum     0.06 -0.22  -0.20   0.25   0.26    0.26    1.00
# Covariance matrix
print(round(cov(complete_numerical_columns), 2))
##           LowPrice HighPrice  CityMPG   HwyMPG FuelCap   Length   Width
## LowPrice    253.65    406.94   -46.81   -52.27   39.95   108.19   27.57
## HighPrice   406.94    795.07   -71.27   -75.96   57.62   158.00   38.25
## CityMPG     -46.81    -71.27    20.67    23.51  -15.34   -47.43  -12.94
## HwyMPG      -52.27    -75.96    23.51    30.66  -18.28   -50.99  -15.01
## FuelCap      39.95     57.62   -15.34   -18.28   19.13    51.77   13.54
## Length      108.19    158.00   -47.43   -50.99   51.77   209.32   42.46
## Width        27.57     38.25   -12.94   -15.01   13.54    42.46   13.18
## Wheelbase    56.97     85.70   -24.46   -27.63   26.74   103.49   21.36
## Height        2.53    -17.71   -11.57   -19.79   16.63    44.24   14.77
## UTurn        14.73     20.39    -7.73    -8.78    7.71    28.30    6.51
## Weight     7601.55  10410.32 -3261.20 -4026.01 3453.88 10282.47 2854.44
## Acc030       -6.67    -11.48     1.62     1.57   -1.13    -3.02   -0.83
## Acc060      -19.47    -33.31     5.07     4.71   -3.51   -11.10   -2.77
## QtrMile     -15.95    -27.95     3.85     3.54   -2.55    -7.88   -1.96
## PageNum    -132.93   -209.70    47.57    31.10  -23.98  -121.40  -26.59
##           Wheelbase  Height   UTurn    Weight  Acc030  Acc060 QtrMile  PageNum
## LowPrice      56.97    2.53   14.73   7601.55   -6.67  -19.47  -15.95  -132.93
## HighPrice     85.70  -17.71   20.39  10410.32  -11.48  -33.31  -27.95  -209.70
## CityMPG      -24.46  -11.57   -7.73  -3261.20    1.62    5.07    3.85    47.57
## HwyMPG       -27.63  -19.79   -8.78  -4026.01    1.57    4.71    3.54    31.10
## FuelCap       26.74   16.63    7.71   3453.88   -1.13   -3.51   -2.55   -23.98
## Length       103.49   44.24   28.30  10282.47   -3.02  -11.10   -7.88  -121.40
## Width         21.36   14.77    6.51   2854.44   -0.83   -2.77   -1.96   -26.59
## Wheelbase     60.57   25.36   14.70   5446.45   -1.35   -4.90   -3.53   -69.23
## Height        25.36   43.59    8.46   4056.04    0.77    2.24    2.19    13.55
## UTurn         14.70    8.46    5.45   1613.01   -0.46   -1.59   -1.14   -19.08
## Weight      5446.45 4056.04 1613.01 752549.45 -199.17 -620.70 -439.80 -6512.19
## Acc030        -1.35    0.77   -0.46   -199.17    0.31    0.87    0.69     5.17
## Acc060        -4.90    2.24   -1.59   -620.70    0.87    2.71    2.14    15.64
## QtrMile       -3.53    2.19   -1.14   -439.80    0.69    2.14    1.72    12.34
## PageNum      -69.23   13.55  -19.08  -6512.19    5.17   15.64   12.34  1359.08

From the correlation display above, we can see quite a few correlations between CityMPG and other numerical variables. Let’s start with the correlation between CityMPG and FuelCap. This is an interesting combination of variables because they are NEGATIVELY correlated with eachother. To be precise, they are correlated at -0.77–Which is logical, as CityMPG increases, the need for a higher gasoline capacity decreases (More fuel efficient).

Let’s analyze this relationship with a simple linear model.

model1 <- lm(CityMPG ~ FuelCap, data = complete_numerical_columns)
summary(model1)
## 
## Call:
## lm(formula = CityMPG ~ FuelCap, data = complete_numerical_columns)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.3846 -1.9837 -0.5216  1.6252  9.1593 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 35.21671    1.17880   29.88   <2e-16 ***
## FuelCap     -0.80174    0.06364  -12.60   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.906 on 108 degrees of freedom
## Multiple R-squared:  0.5951, Adjusted R-squared:  0.5913 
## F-statistic: 158.7 on 1 and 108 DF,  p-value: < 2.2e-16

We can see from the above calculations that both our regular p-value and anova f-statistic P-value is extremely small 2e-16, which is a good indication of a predictor variable. Additionally the \(R^2\) value of ~0.60 (60%) isn’t fantastic, but it isn’t too weak to account for variability in the response variable.

Let’s visualize the above correlations .

ggplot(data = complete_numerical_columns, aes(x = CityMPG, y = FuelCap), na.rm = TRUE) +
  geom_point() +
  geom_smooth(method = 'lm')
## `geom_smooth()` using formula 'y ~ x'

Next let’s run the standard residuals diagnostics on our first predictor variable.

# Check for linearity
plot(model1$residuals ~ complete_numerical_columns$FuelCap)
abline(h = 0, lty = 3)

# Check for normality (1/2)
hist(model1$residuals)

# Check for normality (2/2)
qqnorm(model1$residuals)
qqline(model1$residuals)

From the above three diagrams, we can conclude:

  1. The variable likely does not meet the linearity requirements; The response variable is not evenly scattered, and heavily condensed around the 15-20gal range (Linearity)

  2. Based off of the histogram, we can see the distribution is relatively normal (Normality)

  3. Similar to our linearity requirement, we don’t neccesarily have equal variance as required. (Equal variance)

Explanatory Variable 2

Let’s add the final predictor variable. The next highest correlated variable we can choose without affecting the multicollinearity would be vehicle weight (cars$Weight). Before digging too deep into this additonal variable on our model, we can build a pairwise scatterplot of the three variables to see how they interact.

plot(cars[c(7, 9, 15)])

As we did with the original model, let’s create a new variable which holds a model that accounts for this additional explanatory variable.

model2 <- lm(CityMPG ~ Weight, data = complete_numerical_columns)
summary(model2)
## 
## Call:
## lm(formula = CityMPG ~ Weight, data = complete_numerical_columns)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -5.455 -1.548 -0.166  1.540  8.587 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 37.4486063  1.1177208   33.50   <2e-16 ***
## Weight      -0.0043335  0.0002836  -15.28   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.568 on 108 degrees of freedom
## Multiple R-squared:  0.6838, Adjusted R-squared:  0.6809 
## F-statistic: 233.6 on 1 and 108 DF,  p-value: < 2.2e-16

As with the first explanatory variable, the p-value is extremely small (2e-16), which is a great sign that it’s statistically significant. Our \(R^2\) value is also decently high at ~0.68, which equates to a reasonably strong correlation between the two variables CityMPG and Weight.

Let’s visualize the calculations above.

ggplot(data = complete_numerical_columns, aes(x = CityMPG, y = Weight), na.rm = TRUE) +
  geom_point() +
  geom_smooth(method = 'lm')
## `geom_smooth()` using formula 'y ~ x'

We can see almost the same data trend as with FuelCap in this graph. Following suite to the standard diagnostic procedures we performed for the first model, let’s run through a few diagnostics to ensure our predicted explanatory variable works well.

# Check for linearity
plot(model2$residuals ~ complete_numerical_columns$Weight)
abline(h = 0, lty = 3)

The data does display some trending, but it’s spread considerably better than model1. Let’s check for normality among distribution.

# Check for normality (1/2)
hist(model2$residuals)

The data does appear to be somewhat centered around zero, with a slight right-tail. Using qqnorm we can check for normality in a different way.

# Check for normality (2/2)
qqnorm(model2$residuals)
qqline(model2$residuals)

Once again from the above diagrams, we can conclude:

  1. The data appears to meet linearity requirements, as it’s scattered across the plane

  2. The distribution is relatively normal meeting normality requirements

  3. We appear to have equal variance, at least for the most part meeting the third requirement of equal variance.

Final Regression Model

Pulling all of this data together, let’s build the final model with FuelCap and Weight as the explanatory variables and CityMPG as the response variable.

model3 <- lm(CityMPG ~ FuelCap + Weight, data = complete_numerical_columns)
summary(model3)
## 
## Call:
## lm(formula = CityMPG ~ FuelCap + Weight, data = complete_numerical_columns)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.3447 -1.5551 -0.2244  1.4628  8.5048 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 37.4887087  1.1203171  33.463   <2e-16 ***
## FuelCap     -0.1135817  0.1359716  -0.835    0.405    
## Weight      -0.0038122  0.0006856  -5.560    2e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.572 on 107 degrees of freedom
## Multiple R-squared:  0.6859, Adjusted R-squared:   0.68 
## F-statistic: 116.8 on 2 and 107 DF,  p-value: < 2.2e-16

With this additional explanatory variable included, we can see our \(R^2\) value has actually jumped quite a decent amount to ~0.69 which is considered to be a moderately strong correlation.

As a quick recap of the model diagnostics, we can run a residual error calculation to see the percentage of error in our model’s calculations.

print(sigma(model3) / mean(complete_numerical_columns$CityMPG))
## [1] 0.1237512

We’re sitting at a relatively low 0.12% residual error percentage. Next in line for diagnostics, we can run the following four tools.

# Analysis of Variance
anova(model3)
# Outliers (Bonferonni)
outlierTest(model3)
## No Studentized residuals with Bonferroni p < 0.05
## Largest |rstudent|:
##   rstudent unadjusted p-value Bonferroni p
## 4 3.571288         0.00053569     0.058926
# QQ Plot
qqPlot(model3, main = "QQ Plot")

## [1]  4 90
# Leverage Points in data
leveragePlots(model3)

Both the anova and bonferonni tests come up indicating that we have no significant issues with outliers in our dataset or analysis. Additionally, if we wanted to test the variance across multiple different models, we could run the anova test with each different model (I.E. anova(model1, model2)). However, because I built the model from the ground up, I don’t need to throw in guesswork as to which model would be most appropriate for this task.

Summary

We do see a strong correlation between the CityMPG, Weight, and FuelCap variables. I am failing to reject the null hypothesis (\(H_0\)) due to this fact. See Recommendations below for a more in-depth summary.

Analysis 5:[Multiple Regression 2 - One Quantitative/One Categorical Explanatory Variables]

Analyst:[Delmar Wilmont Randolph]

To begin, we need to import necessary packages.

#import packages
library(tidyverse)
library (sjstats)
library (pwr)
install.packages("car")
## 
## The downloaded binary packages are in
##  /var/folders/0s/cwbp3rpx67q0ts2h2xvhzzbh0000gn/T//Rtmpt3GvSH/downloaded_packages
library (car)

Import the Cars 2015 data set and remove rows with any missing values.

# Load Data
cars <- read.csv("./Cars2015.csv")
cars

[H_0: There is a strong correlation between the high-price of a vehicle, it’s fuel capacity, and city MPG. I propose that we will see a positively correlated linear relationship between the high-price, the fuel capacity, and city MPG of a vehicle.

H_A: There is an insignificant or non-existent correlation between a vehicle’s high-price, the fuel capacity, and city MPG.]

Response Variable

The chosen response variable for this analysis will be High-Price; Visualize the data behind this variable.

ggplot(data = cars) +
  xlab("High-Price") +
  geom_boxplot(mapping = aes(x = HighPrice))

ggplot(data = cars) +
  xlab("High-Price") +
  geom_histogram(mapping = aes(x = HighPrice), binwidth = 0.75)

##### Explanatory Variable 1 Finding predictors of our response variable (HighPrice), requires a correlation matrix. We will find highly correlated variables and work from there.

# Pull the complete columns from the data set
numerical_columns <- cars[complete.cases(cars), ]
  
# Pull the complete numerical columns from the data set
# Correlation matrix
complete_numerical_columns <- numerical_columns[, sapply(numerical_columns, is.numeric)]
print(round(cor(complete_numerical_columns), 2))
##           LowPrice HighPrice CityMPG HwyMPG FuelCap Length Width Wheelbase
## LowPrice      1.00      0.91   -0.65  -0.59    0.57   0.47  0.48      0.46
## HighPrice     0.91      1.00   -0.56  -0.49    0.47   0.39  0.37      0.39
## CityMPG      -0.65     -0.56    1.00   0.93   -0.77  -0.72 -0.78     -0.69
## HwyMPG       -0.59     -0.49    0.93   1.00   -0.75  -0.64 -0.75     -0.64
## FuelCap       0.57      0.47   -0.77  -0.75    1.00   0.82  0.85      0.79
## Length        0.47      0.39   -0.72  -0.64    0.82   1.00  0.81      0.92
## Width         0.48      0.37   -0.78  -0.75    0.85   0.81  1.00      0.76
## Wheelbase     0.46      0.39   -0.69  -0.64    0.79   0.92  0.76      1.00
## Height        0.02     -0.10   -0.39  -0.54    0.58   0.46  0.62      0.49
## UTurn         0.40      0.31   -0.73  -0.68    0.76   0.84  0.77      0.81
## Weight        0.55      0.43   -0.83  -0.84    0.91   0.82  0.91      0.81
## Acc030       -0.76     -0.74    0.64   0.51   -0.47  -0.38 -0.41     -0.31
## Acc060       -0.74     -0.72    0.68   0.52   -0.49  -0.47 -0.46     -0.38
## QtrMile      -0.76     -0.76    0.65   0.49   -0.45  -0.42 -0.41     -0.35
## PageNum      -0.23     -0.20    0.28   0.15   -0.15  -0.23 -0.20     -0.24
##           Height UTurn Weight Acc030 Acc060 QtrMile PageNum
## LowPrice    0.02  0.40   0.55  -0.76  -0.74   -0.76   -0.23
## HighPrice  -0.10  0.31   0.43  -0.74  -0.72   -0.76   -0.20
## CityMPG    -0.39 -0.73  -0.83   0.64   0.68    0.65    0.28
## HwyMPG     -0.54 -0.68  -0.84   0.51   0.52    0.49    0.15
## FuelCap     0.58  0.76   0.91  -0.47  -0.49   -0.45   -0.15
## Length      0.46  0.84   0.82  -0.38  -0.47   -0.42   -0.23
## Width       0.62  0.77   0.91  -0.41  -0.46   -0.41   -0.20
## Wheelbase   0.49  0.81   0.81  -0.31  -0.38   -0.35   -0.24
## Height      1.00  0.55   0.71   0.21   0.21    0.25    0.06
## UTurn       0.55  1.00   0.80  -0.36  -0.41   -0.37   -0.22
## Weight      0.71  0.80   1.00  -0.41  -0.43   -0.39   -0.20
## Acc030      0.21 -0.36  -0.41   1.00   0.95    0.95    0.25
## Acc060      0.21 -0.41  -0.43   0.95   1.00    0.99    0.26
## QtrMile     0.25 -0.37  -0.39   0.95   0.99    1.00    0.26
## PageNum     0.06 -0.22  -0.20   0.25   0.26    0.26    1.00
# Covariance matrix
print(round(cov(complete_numerical_columns), 2))
##           LowPrice HighPrice  CityMPG   HwyMPG FuelCap   Length   Width
## LowPrice    253.65    406.94   -46.81   -52.27   39.95   108.19   27.57
## HighPrice   406.94    795.07   -71.27   -75.96   57.62   158.00   38.25
## CityMPG     -46.81    -71.27    20.67    23.51  -15.34   -47.43  -12.94
## HwyMPG      -52.27    -75.96    23.51    30.66  -18.28   -50.99  -15.01
## FuelCap      39.95     57.62   -15.34   -18.28   19.13    51.77   13.54
## Length      108.19    158.00   -47.43   -50.99   51.77   209.32   42.46
## Width        27.57     38.25   -12.94   -15.01   13.54    42.46   13.18
## Wheelbase    56.97     85.70   -24.46   -27.63   26.74   103.49   21.36
## Height        2.53    -17.71   -11.57   -19.79   16.63    44.24   14.77
## UTurn        14.73     20.39    -7.73    -8.78    7.71    28.30    6.51
## Weight     7601.55  10410.32 -3261.20 -4026.01 3453.88 10282.47 2854.44
## Acc030       -6.67    -11.48     1.62     1.57   -1.13    -3.02   -0.83
## Acc060      -19.47    -33.31     5.07     4.71   -3.51   -11.10   -2.77
## QtrMile     -15.95    -27.95     3.85     3.54   -2.55    -7.88   -1.96
## PageNum    -132.93   -209.70    47.57    31.10  -23.98  -121.40  -26.59
##           Wheelbase  Height   UTurn    Weight  Acc030  Acc060 QtrMile  PageNum
## LowPrice      56.97    2.53   14.73   7601.55   -6.67  -19.47  -15.95  -132.93
## HighPrice     85.70  -17.71   20.39  10410.32  -11.48  -33.31  -27.95  -209.70
## CityMPG      -24.46  -11.57   -7.73  -3261.20    1.62    5.07    3.85    47.57
## HwyMPG       -27.63  -19.79   -8.78  -4026.01    1.57    4.71    3.54    31.10
## FuelCap       26.74   16.63    7.71   3453.88   -1.13   -3.51   -2.55   -23.98
## Length       103.49   44.24   28.30  10282.47   -3.02  -11.10   -7.88  -121.40
## Width         21.36   14.77    6.51   2854.44   -0.83   -2.77   -1.96   -26.59
## Wheelbase     60.57   25.36   14.70   5446.45   -1.35   -4.90   -3.53   -69.23
## Height        25.36   43.59    8.46   4056.04    0.77    2.24    2.19    13.55
## UTurn         14.70    8.46    5.45   1613.01   -0.46   -1.59   -1.14   -19.08
## Weight      5446.45 4056.04 1613.01 752549.45 -199.17 -620.70 -439.80 -6512.19
## Acc030        -1.35    0.77   -0.46   -199.17    0.31    0.87    0.69     5.17
## Acc060        -4.90    2.24   -1.59   -620.70    0.87    2.71    2.14    15.64
## QtrMile       -3.53    2.19   -1.14   -439.80    0.69    2.14    1.72    12.34
## PageNum      -69.23   13.55  -19.08  -6512.19    5.17   15.64   12.34  1359.08

From the data above, we can see some correlations between our response variable and other quantitative / explanatory variables. We will begin with HighPrice and FuelCap. It is important to note that they are POSITIVELY correlated with each other. Specifically, they are correlated at 0.47– which can be expected – as the price increases, the fuel capacity of the vehicle also increases - reasons for this could be a variety of factors (size, type, etc.)

Let’s analyze this relationship with a simple linear model.

model3 <- lm(HighPrice ~ FuelCap, data = complete_numerical_columns)
summary(model3)
## 
## Call:
## lm(formula = HighPrice ~ FuelCap, data = complete_numerical_columns)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -44.594 -12.678  -8.164   7.049 148.802 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -5.0972    10.1589  -0.502    0.617    
## FuelCap       3.0115     0.5484   5.491 2.67e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 25.05 on 108 degrees of freedom
## Multiple R-squared:  0.2183, Adjusted R-squared:  0.211 
## F-statistic: 30.15 on 1 and 108 DF,  p-value: 2.672e-07

We can see from the above calculations that both our regular p-value and anova f-statistic P-value is over 0.05, specifically around 0.25781, which suggests that changes in the predictor are not associated with changes in the response. Additionally the \(R^2\) value of ~0.20 (20%) indicates that our variable does account for much of the variance.

Let’s visualize the above correlations .

ggplot(data = complete_numerical_columns, aes(x = HighPrice, y = FuelCap), na.rm = TRUE) +
  geom_point() +
  geom_smooth(method = 'lm')
## `geom_smooth()` using formula 'y ~ x'

Next let’s run the standard residuals diagnostics on our first predictor variable.

# Check for linearity
plot(model3$residuals ~ complete_numerical_columns$FuelCap)
abline(h = 0, lty = 3)

# Check for normality (1/2)
hist(model3$residuals)

# Check for normality (2/2)
qqnorm(model3$residuals)
qqline(model3$residuals)

From the data above, we can conclude:

  1. The variable does not meet the linearity requirements; The response variable is not evenly scattered, and heavily condensed around the 10-20 range (Linearity)

  2. Based off of the histogram, we can see the distribution is somewhat normal (Normality)

  3. Similar to our linearity requirement, we do not have equal variance as required. (Equal variance)

Explanatory Variable 2

The next correlated variable we can choose would be the City MPG (cars$CityMPG). A visual aid would be beneficial in interpreting this variable.

plot(cars[c(5, 7, 9)])

Create a new variable which holds a model that accounts for this explanatory variable.

model2 <- lm(HighPrice ~ CityMPG, data = complete_numerical_columns)
summary(model2)
## 
## Call:
## lm(formula = HighPrice ~ CityMPG, data = complete_numerical_columns)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -31.170 -13.575  -4.940   6.534 139.331 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 120.7870    10.5511  11.448  < 2e-16 ***
## CityMPG      -3.4483     0.4961  -6.951 2.88e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 23.55 on 108 degrees of freedom
## Multiple R-squared:  0.3091, Adjusted R-squared:  0.3027 
## F-statistic: 48.32 on 1 and 108 DF,  p-value: 2.878e-10

As with the first explanatory variable, the p-value is larger than 0.05, which shows that it is not statistically significant. Our \(R^2\) value is also low at ~0.30, which equates to a weak correlation between the two variables HighPrice and CityMPG.

Let’s visualize the calculations above.

ggplot(data = complete_numerical_columns, aes(x = HighPrice, y = CityMPG), na.rm = TRUE) +
  geom_point() +
  geom_smooth(method = 'lm')
## `geom_smooth()` using formula 'y ~ x'

We can see there is a NEGATIVE correlation - the higher the price, the less City MPG the vehicle has. Following the previous variable, we need to perform the standard diagnostic procedures we performed for the first model, let’s run through a few diagnostics to ensure our predicted explanatory variable works.

# Check for linearity
plot(model2$residuals ~ complete_numerical_columns$Weight)
abline(h = 0, lty = 3)

The data does not display any trending, but it’s spread considerably better than model1. Let’s check for normality among distribution.

# Check for normality (1/2)
hist(model2$residuals)

The data does appear to be somewhat skewed-right, with a right-tail. Using qqnorm we can check for normality in a different way.

# Check for normality (2/2)
qqnorm(model2$residuals)
qqline(model2$residuals)

Once again from the above diagrams, we can conclude:

  1. The data appears to meet linearity requirements, as it’s scattered across the plane

  2. The distribution is not normal, not meeting requirements

  3. We appear to have equal variance, at least for the most part meeting the third requirement of equal variance.

Final Regression Model

Pulling all of this data together, let’s build the final model with FuelCap and CityMPG as the explanatory variables and HighPrice as the response variable.

# Fit a multiple linear regression model for high-price as a function of the city MPG, and fuel tank Capacity

finalMod <- lm(HighPrice ~ CityMPG + FuelCap, data = complete_numerical_columns)
summary(finalMod)
## 
## Call:
## lm(formula = HighPrice ~ CityMPG + FuelCap, data = complete_numerical_columns)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -30.675 -13.445  -4.998   7.213 140.811 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 100.4040    29.1272   3.447 0.000811 ***
## CityMPG      -2.9958     0.7812  -3.835 0.000213 ***
## FuelCap       0.6097     0.8119   0.751 0.454294    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 23.59 on 107 degrees of freedom
## Multiple R-squared:  0.3127, Adjusted R-squared:  0.2999 
## F-statistic: 24.34 on 2 and 107 DF,  p-value: 1.934e-09

With this additional explanatory variable included, we can see our \(R^2\) value has remained below 30%, which is a relatively weak correlation.

As a quick recap of the model diagnostics, we can run a residual error calculation to see the percentage of error in our model’s calculations.

print(sigma(finalMod) / mean(complete_numerical_columns$HighPrice))
## [1] 0.4802768

We’re sitting at a relatively low 0.48% residual error percentage. Next in line for diagnostics, we can run the following four tools.

# Analysis of Variance
anova(finalMod)
# Outliers (Bonferonni)
outlierTest(finalMod)
##    rstudent unadjusted p-value Bonferroni p
## 65 7.370203         3.9141e-11   4.3055e-09
# QQ Plot
qqPlot(finalMod, main = "QQ Plot")

## [1] 51 65
# Leverage Points in data
leveragePlots(finalMod)

Both the anova and bonferonni test results indicate that we have no significant issues with outliers in our data set or analysis. Additionally, if we wanted to test the variance across multiple different models, we could run the anova test with each different model.

Summary

We do not see a significant correlation between the HighPrice, CityMPG, and FuelCap variables. I reject the null hypothesis due to this fact. See Recommendations below for a more in-depth summary.

Recommendations

Analysis 1:

my estimate is the type of drive and the size of a car are dependent, I thought AWD cars’ size will larger than FWD cars and RWD cars. However, analysis#1 proves my guess is wrong. Based on the sample data, we get there is no significant evidence to conclude that there is an association between the type of drive and the size of the car at the 95% confidence level. One limitation in my finding is the sample size is not representative enough for all cars in 2015.

Analysis 2: James Igwenagu

I thought that the different varity of cars manufacture or make would vary in the Fuel capacity of the different vehicles. Depending on the size of the cars i thought here would be a huge difference in fuelcap. From analysis 2 it shows that there was little to no difference. A limitation i found was that depending on the make of the vehicle the fuel cap was almost the same for all od them and we also have to out into account the brand names of the vehicle and the type of fuel needed.

Analysis 3:
Analysis 4:

My goal in the analysis was to prove a relationship between the response variable City MPG and explanatory variables Dry Weight and Fuel Tank Capacity. The efforts to do so were successful, and there was found to be a negative correlation between the CityMPG:FuelCap. This relationship is nothing short of expected, as the fuel efficiency of a engine increases, one would expect that the need for a larger fuel tank decreases. Beyond fuel tank capacity, I also found that there was once again a negative linear correlation between CityMPG:Weight; As the CityMPG went up, the vehicle’s weight went down. Need I repeat, this was not unexpected, heavy vehicles need larger engines, and larger engines mean more fuel consumption (Lower MPGs). I don’t believe there are any limitations to the findings in this dataset, the only future limitation would be if eMPG (Electric simulated MPG) were included (I.E. Telas/Chevy Volt). This addition would skew the data in many unfavorable ways. I would suspect that this analysis did not present any new findings to the reader, as it’s all basic logic.

Analysis 5:

[my estimate is the higher price range of the vehicle would be affected by the City MPG, and Fuel capacity of the vehicle, and proving that the latter two variables are dependent on each other, I thought these two variables would drastically effect the price of the vehicle, however my analyses proved otherwise. Based on the sample data, we conclude there is no significant evidence to verify that there is an association between the City MPG, fuel capacity and price of the vehicle at the 95% confidence level. One limitation in my findings is the sample size is not representative enough for all cars in 2015. If one were to make their car purchase decision based on these variables, one would need to know that they do not correlate to the overall price of the vehicle.]

Reflections

Alec Mattu:

I would say that the three unit projects significantly expanded my understanding of performing statistical analyses. Not only did it provide and opportunity to perform three independent analyses on the same dataset from different perspectives, it also provided the chance to view fellow student’s ways of performing statistical functions and tasks. In summary, these past three projects allowed me to personally explore: Analysis on a single categorical variable, draw inferences on a single categorical proportion, and finally, multiple linear regression on two quantitative variables and one response variable. While I learned a plethora of things from unit projects, I would say that the most important is how to implement linear regression on multiple variables (categorical and numerical). Thankfully, I personally faced very few challenges when completing these unit projects–The only initial hiccup was setting up proper .Rmd file exporting to HTML/PDFs.

Yiling Du:

Three Unit Projects help me to use the statistics knowledge I learned in class in a real data file. I learned how to use R language to analyze big data. Because of the Unit projects, I got more familiar to write R code. In addition, I learned we can get a lot of information through analyzing a data file, such as we made five different analyses for each unit project and we have different interesting findings for each analysis. I have not faced many challenges in completing the unit projects because the R demo videos cover most of the skills to use R.

[Add text section on your reflections about unit projects. Be sure to address each of the prompts on the instruction sheet. a. What impact did the Unit Projects have on your understanding of statistics? b. What new knowledge did you gain about your statistical analyses? Briefly explain.c. What did you learn by creating the unit projects? d. What challenges did you face completing the unit projects? ]

Delmar Randolph:

I believe that these unit projects have immensely expanded my knowledge of statistics and working with R code. Specifically, from Unit 1 to the latest project, I felt that my skills working in statistics have only improved. Some challenges I faced were the fact that I have not taken a statistics course in a long while. Therefore, I had to re-familiarize myself with the concepts in order to perform adequately in this class. Thankfully, it provided the chance to view fellow student’s ways of performing statistical functions and tasks, as well as their methods in thinking and approaching a problem. In summary, these past three projects allowed me to perform various modes of statistical computation and working with big data such as: Analysis on a single categorical variable, draw inferences on a single categorical proportion, and lastly, multiple linear regression on two quantitative variables and one response variable.

James Igwenagu

These projects have shown me yet another way to and platform to use to Calculate statistical data using a data set. I was always use ti using python which is a little harder. R was more Straight forward and easier to understand and use. I learned a lot about Statistical data Calculations and how to clean and refine it. It was a great experience. I dont know if i will be able to implement using this in the future but it good to have a grounded understanding of it.